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>
This commit is contained in:
Kevin Wolf 2015-01-30 20:37:55 +01:00 committed by Michael Tokarev
parent 02f292d905
commit 55a1099603

View File

@ -512,7 +512,7 @@ InetSocketAddress *inet_parse(const char *str, Error **errp)
{ {
InetSocketAddress *addr; InetSocketAddress *addr;
const char *optstr, *h; const char *optstr, *h;
char host[64]; char host[65];
char port[33]; char port[33];
int to; int to;
int pos; int pos;