From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH] usb-host: add range checks for usb-host parameters
Date: Thu, 12 Dec 2013 14:47:26 +0100 [thread overview]
Message-ID: <1386856046-28929-1-git-send-email-kraxel@redhat.com> (raw)
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
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 other threads:[~2013-12-12 13:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1386856046-28929-1-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).