qemu-sockets: avoid strlen of NULL pointer
commite23a22e620e84f42bdbd473b82672654e7c8de73
authorJens Osterkamp <jens@linux.vnet.ibm.com>
Mon, 12 Apr 2010 08:51:01 +0000 (12 10:51 +0200)
committerAurelien Jarno <aurelien@aurel32.net>
Tue, 18 May 2010 17:49:16 +0000 (18 19:49 +0200)
treeddc9cebadadc2810e1228759ab02ea575aa4d9ab
parent81bbe906c89b6b7af58a1eeb96ec5a0bfdc3386f
qemu-sockets: avoid strlen of NULL pointer

If the user wants to create a chardev of type socket but forgets to give a
host= option, qemu_opt_get returns NULL. This NULL pointer is then fed into
strlen a few lines below without a check which results in a segfault.
This fixes it.

Signed-off-by: Jens Osterkamp <jens@linux.vnet.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
qemu-sockets.c