summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@web.de>2010-06-02 17:19:55 -0300
committerAurelien Jarno <aurelien@aurel32.net>2010-06-09 12:44:57 +0200
commitd37dbf988d0d350d252c6952fcde5f4b94eed010 (patch)
tree7acf5fd59113a680c7de40b0ee5247ac30bbc22a
parentFix -usbdevice crash (diff)
downloadqemu-kvm-d37dbf988d0d350d252c6952fcde5f4b94eed010.tar.gz
qemu-kvm-d37dbf988d0d350d252c6952fcde5f4b94eed010.tar.bz2
qemu-kvm-d37dbf988d0d350d252c6952fcde5f4b94eed010.zip
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> (cherry picked from commit 702f3e0fb52c124c07f215426eeadb70a716643f)
-rw-r--r--hw/usb-bus.c4
1 files changed, 3 insertions, 1 deletions
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);
}