qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH] usb-host: add range checks for usb-host parameters


From: Gerd Hoffmann
Subject: [Qemu-devel] [PATCH] usb-host: add range checks for usb-host parameters
Date: Thu, 12 Dec 2013 14:47:26 +0100

Signed-off-by: Gerd Hoffmann <address@hidden>
---
 hw/usb/host-libusb.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index fd320cd..164adf8 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -898,6 +898,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;
-- 
1.8.3.1




reply via email to

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