diff mbox

[PULL,19/46] qemu-sockets: Fix buffer overflow in inet_parse()

Message ID 55a10996034cb2e633f0437cedd97f345183c0ec.1423549659.git.mjt@msgid.tls.msk.ru
State New
Headers show

Commit Message

Michael Tokarev Feb. 10, 2015, 6:34 a.m. UTC
From: Kevin Wolf <kwolf@redhat.com>

The size of the stack allocated host[] array didn't account for the
terminating '\0' byte that sscanf() writes. Fix the array size.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 util/qemu-sockets.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index cf4b91f..61fc3c1 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -512,7 +512,7 @@  InetSocketAddress *inet_parse(const char *str, Error **errp)
 {
     InetSocketAddress *addr;
     const char *optstr, *h;
-    char host[64];
+    char host[65];
     char port[33];
     int to;
     int pos;