diff options
author | Jan Kiszka <jan.kiszka@web.de> | 2010-03-07 12:17:08 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-03-17 10:42:12 -0500 |
commit | 702f3e0fb52c124c07f215426eeadb70a716643f (patch) | |
tree | 79ae2d224db4ca9332f7ae6f184a459d431e65ce /hw | |
parent | cc39a92cbfc80c70d2b83708a4c9b309c3126ac3 (diff) | |
download | qemu-702f3e0fb52c124c07f215426eeadb70a716643f.zip qemu-702f3e0fb52c124c07f215426eeadb70a716643f.tar.gz qemu-702f3e0fb52c124c07f215426eeadb70a716643f.tar.bz2 |
Avoid crash on '-usbdevice <device>' without parameters
Many usbdevice_init implementors assume params is non-NULL.
Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/usb-bus.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/usb-bus.c b/hw/usb-bus.c index e2d87f2..ce8a694 100644 --- a/hw/usb-bus.c +++ b/hw/usb-bus.c @@ -264,7 +264,8 @@ USBDevice *usbdevice_create(const char *cmdline) USBBus *bus = usb_bus_find(-1 /* any */); DeviceInfo *info; USBDeviceInfo *usb; - char driver[32], *params; + char driver[32]; + const char *params; int len; params = strchr(cmdline,':'); @@ -275,6 +276,7 @@ USBDevice *usbdevice_create(const char *cmdline) len = sizeof(driver); pstrcpy(driver, len, cmdline); } else { + params = ""; pstrcpy(driver, sizeof(driver), cmdline); } |