From 36b6c1013d11e03d70b0b7e74d2e90fffa8a2d8a Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Wed, 2 Jun 2010 17:19:55 -0300 Subject: Avoid crash on '-usbdevice ' without parameters Many usbdevice_init implementors assume params is non-NULL. Signed-off-by: Jan Kiszka Signed-off-by: Anthony Liguori (cherry picked from commit 702f3e0fb52c124c07f215426eeadb70a716643f) --- hw/usb-bus.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/usb-bus.c b/hw/usb-bus.c index 7c823147a..3bb89862b 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); } -- cgit v1.2.3-65-gdbad