mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
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>
This commit is contained in:
parent
cc39a92cbf
commit
702f3e0fb5
1 changed files with 3 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue