summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorKevin Wolf2015-01-30 20:37:55 +0100
committerMichael Tokarev2015-02-10 07:27:20 +0100
commit55a10996034cb2e633f0437cedd97f345183c0ec (patch)
tree27dc6f669c1ed3af7a56fa026a05b659fa5ee114 /util
parentvl.c: fix memory leak spotted by valgrind (diff)
downloadqemu-55a10996034cb2e633f0437cedd97f345183c0ec.tar.gz
qemu-55a10996034cb2e633f0437cedd97f345183c0ec.tar.xz
qemu-55a10996034cb2e633f0437cedd97f345183c0ec.zip
qemu-sockets: Fix buffer overflow in inet_parse()
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>
Diffstat (limited to 'util')
-rw-r--r--util/qemu-sockets.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index cf4b91f7f5..61fc3c1364 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;