]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commitdiff
usb-linux: Ensure devep != 0
authorHans de Goede <hdegoede@redhat.com>
Tue, 31 May 2011 09:35:22 +0000 (11:35 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 14 Jun 2011 10:56:49 +0000 (12:56 +0200)
So that we don't index endp_table with a negative index.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb-linux.c

index feb4d36d0bef320c12a5e3824b82b8b09dd6e2f0..2e0495e239a3fb8cc9bdd34985d6332c90ef0d47 100644 (file)
@@ -1029,6 +1029,11 @@ static int usb_linux_update_endp_table(USBHostDevice *s)
             }
 
             devep = descriptors[i + 2];
+            if ((devep & 0x0f) == 0) {
+                fprintf(stderr, "usb-linux: invalid ep descriptor, ep == 0\n");
+                return 1;
+            }
+
             switch (descriptors[i + 3] & 0x3) {
             case 0x00:
                 type = USBDEVFS_URB_TYPE_CONTROL;