[USBCCGP]

- reset interface count before loop
- add extra checks

svn path=/trunk/; revision=66483
This commit is contained in:
Johannes Anderwald 2015-02-28 09:48:16 +00:00
parent 7a357f830c
commit 1b229a4827

View file

@ -326,6 +326,11 @@ USBCCGP_ScanConfigurationDescriptor(
// count all interface descriptors // count all interface descriptors
// //
DescriptorCount = ConfigurationDescriptor->bNumInterfaces; DescriptorCount = ConfigurationDescriptor->bNumInterfaces;
if (DescriptorCount == 0)
{
DPRINT1("[USBCCGP] DescriptorCount is zero\n");
return STATUS_INVALID_PARAMETER;
}
// //
// allocate array holding the interface descriptors // allocate array holding the interface descriptors
@ -339,6 +344,11 @@ USBCCGP_ScanConfigurationDescriptor(
return STATUS_INSUFFICIENT_RESOURCES; return STATUS_INSUFFICIENT_RESOURCES;
} }
//
// reset interface list count
//
FDODeviceExtension->InterfaceListCount = 0;
do do
{ {
// //
@ -350,6 +360,7 @@ USBCCGP_ScanConfigurationDescriptor(
// //
// store in interface list // store in interface list
// //
ASSERT(FDODeviceExtension->InterfaceListCount < DescriptorCount);
FDODeviceExtension->InterfaceList[FDODeviceExtension->InterfaceListCount].InterfaceDescriptor = InterfaceDescriptor; FDODeviceExtension->InterfaceList[FDODeviceExtension->InterfaceListCount].InterfaceDescriptor = InterfaceDescriptor;
FDODeviceExtension->InterfaceListCount++; FDODeviceExtension->InterfaceListCount++;
} }