summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-06-13 18:18:55 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-06-13 18:18:55 +0100
commit06a59afac4505f5ed942db4200e5ca16fcbba74d (patch)
tree5b30c1eb508f506671d0ffd70f0831c3ac8a9709
parent80008a6a298104e25d1b806b673eccc5ff58d1aa (diff)
parentf3cda6e060c483dee1fa497699fd5f972e5031da (diff)
downloadhqemu-06a59afac4505f5ed942db4200e5ca16fcbba74d.zip
hqemu-06a59afac4505f5ed942db4200e5ca16fcbba74d.tar.gz
Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20140613-1' into staging
usb-host: add range checks for usb-host parameters # gpg: Signature made Fri 13 Jun 2014 12:33:05 BST using RSA key ID D3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" * remotes/kraxel/tags/pull-usb-20140613-1: usb-host: add range checks for usb-host parameters Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-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 afbf156..33b5b9f 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;
OpenPOWER on IntegriCloud