DbgPrint("Descriptor Type %x Length %lu Offset %lu\n", Descriptor->bDescriptorType, Descriptor->bLength, ((ULONG_PTR)Descriptor - (ULONG_PTR)ConfigurationDescriptor));
// check for invalid descriptors
- if (!Descriptor->bLength)
+ if (!Descriptor->bLength)
{
DbgPrint("Bogus Descriptor!!!\n");
break;
// count all interface descriptors
//
DescriptorCount = ConfigurationDescriptor->bNumInterfaces;
+ if (DescriptorCount == 0)
+ {
+ DPRINT1("[USBCCGP] DescriptorCount is zero\n");
+ return STATUS_INVALID_PARAMETER;
+ }
//
// allocate array holding the interface descriptors
return STATUS_INSUFFICIENT_RESOURCES;
}
+ //
+ // reset interface list count
+ //
+ FDODeviceExtension->InterfaceListCount = 0;
+
do
{
//
//
// store in interface list
//
+ ASSERT(FDODeviceExtension->InterfaceListCount < DescriptorCount);
FDODeviceExtension->InterfaceList[FDODeviceExtension->InterfaceListCount].InterfaceDescriptor = InterfaceDescriptor;
FDODeviceExtension->InterfaceListCount++;
}
Status = USBCCGP_SyncUrbRequest(DeviceExtension->NextDeviceObject, Urb);
//
- // did it succeeed
+ // did it succeed
//
if (NT_SUCCESS(Status))
{