aboutsummaryrefslogtreecommitdiff
path: root/hw/usb
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2013-12-12 14:47:15 +0100
committerGerd Hoffmann <kraxel@redhat.com>2014-06-13 12:34:57 +0200
commitf3cda6e060c483dee1fa497699fd5f972e5031da (patch)
tree12aec12d59ffc4a788a781a5834fad94337b9cb5 /hw/usb
parent2a2c4830c0068d70443f3dddc4cc668f0c601b5c (diff)
usb-host: add range checks for usb-host parameters
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb')
-rw-r--r--hw/usb/host-libusb.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index afbf1563f4..33b5b9ff19 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -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;