Blob Blame History Raw
diff -ru libusb-0.1.12.orig/descriptors.c libusb-0.1.12/descriptors.c
--- libusb-0.1.12.orig/descriptors.c	2006-03-04 02:52:46.000000000 +0000
+++ libusb-0.1.12/descriptors.c	2010-02-16 17:31:42.000000000 +0000
@@ -235,11 +235,12 @@
     }
 
     /* Did we hit an unexpected descriptor? */
-    usb_parse_descriptor(buffer, "bb", &header);
-    if ((size >= DESC_HEADER_LENGTH) &&
-        ((header.bDescriptorType == USB_DT_CONFIG) ||
-        (header.bDescriptorType == USB_DT_DEVICE)))
-      return parsed;
+    if (size >= DESC_HEADER_LENGTH) {
+      usb_parse_descriptor(buffer, "bb", &header);
+      if (((header.bDescriptorType == USB_DT_CONFIG) ||
+          (header.bDescriptorType == USB_DT_DEVICE)))
+        return parsed;
+    }
 
     if (ifp->bNumEndpoints > USB_MAXENDPOINTS) {
       if (usb_debug >= 1)