]> Git Repo - qemu.git/commitdiff
usb-host: add range checks for usb-host parameters
authorGerd Hoffmann <[email protected]>
Thu, 12 Dec 2013 13:47:15 +0000 (14:47 +0100)
committerGerd Hoffmann <[email protected]>
Fri, 13 Jun 2014 10:34:57 +0000 (12:34 +0200)
Signed-off-by: Gerd Hoffmann <[email protected]>
hw/usb/host-libusb.c

index afbf1563f459479eecc05d6cc2b249c9a3f3b67e..33b5b9ff19c734a666c1af6c7cbc694e5697f2bc 100644 (file)
@@ -952,6 +952,19 @@ static int usb_host_initfn(USBDevice *udev)
 {
     USBHostDevice *s = USB_HOST_DEVICE(udev);
 
+    if (s->match.vendor_id > 0xffff) {
+        error_report("vendorid out of range");
+        return -1;
+    }
+    if (s->match.product_id > 0xffff) {
+        error_report("productid out of range");
+        return -1;
+    }
+    if (s->match.addr > 127) {
+        error_report("hostaddr out of range");
+        return -1;
+    }
+
     loglevel = s->loglevel;
     udev->flags |= (1 << USB_DEV_FLAG_IS_HOST);
     udev->auto_attach = 0;
This page took 0.028491 seconds and 4 git commands to generate.