Author: janderwald
Date: Sat Feb 28 09:48:16 2015
New Revision: 66483
URL:
http://svn.reactos.org/svn/reactos?rev=66483&view=rev
Log:
[USBCCGP]
- reset interface count before loop
- add extra checks
Modified:
trunk/reactos/drivers/usb/usbccgp/descriptor.c
Modified: trunk/reactos/drivers/usb/usbccgp/descriptor.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbccgp/descri…
==============================================================================
--- trunk/reactos/drivers/usb/usbccgp/descriptor.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbccgp/descriptor.c [iso-8859-1] Sat Feb 28 09:48:16 2015
@@ -326,6 +326,11 @@
// 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
@@ -338,6 +343,11 @@
//
return STATUS_INSUFFICIENT_RESOURCES;
}
+
+ //
+ // reset interface list count
+ //
+ FDODeviceExtension->InterfaceListCount = 0;
do
{
@@ -350,6 +360,7 @@
//
// store in interface list
//
+ ASSERT(FDODeviceExtension->InterfaceListCount < DescriptorCount);
FDODeviceExtension->InterfaceList[FDODeviceExtension->InterfaceListCount].InterfaceDescriptor
= InterfaceDescriptor;
FDODeviceExtension->InterfaceListCount++;
}