qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v2] Avoid crash on '-usbdevice <device>' without par


From: Jan Kiszka
Subject: [Qemu-devel] [PATCH v2] Avoid crash on '-usbdevice <device>' without parameters
Date: Sun, 07 Mar 2010 12:17:08 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

Many usbdevice_init implementors assume params is non-NULL.

Signed-off-by: Jan Kiszka <address@hidden>
---

Build fixed - sorry.

 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 7c82314..3bb8986 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);
     }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]