Skip to content

Commit

Permalink
usb-host: add range checks for usb-host parameters
Browse files Browse the repository at this point in the history
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
  • Loading branch information
kraxel committed Jun 13, 2014
1 parent 2a2c483 commit f3cda6e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions hw/usb/host-libusb.c
Expand Up @@ -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;
Expand Down

0 comments on commit f3cda6e

Please sign in to comment.