Skip to content

Commit

Permalink
Avoid crash on '-usbdevice <device>' without parameters
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jan-kiszka authored and Anthony Liguori committed Mar 17, 2010
1 parent cc39a92 commit 702f3e0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion hw/usb-bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,':');
Expand All @@ -275,6 +276,7 @@ USBDevice *usbdevice_create(const char *cmdline)
len = sizeof(driver);
pstrcpy(driver, len, cmdline);
} else {
params = "";
pstrcpy(driver, sizeof(driver), cmdline);
}

Expand Down

0 comments on commit 702f3e0

Please sign in to comment.