mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[USBPORT] Correctly find interface descriptor in USBPORT_ParseConfigurationDescriptor
There can be other descriptors between the config descriptor and the first interface descriptor, so we specifically need to check for the interface descriptor type and skip anything before that. We also need to guard against bLength == 0, which would cause an infinite loop, instead of doing a second bDescriptorType check.
This commit is contained in:
parent
1946f6bb25
commit
36c1cb0910
1 changed files with 1 additions and 1 deletions
|
@ -201,7 +201,7 @@ USBPORT_ParseConfigurationDescriptor(IN PUSB_CONFIGURATION_DESCRIPTOR ConfigDesc
|
|||
*OutAlternate = 0;
|
||||
|
||||
for (TmpDescriptor = (PUSB_CONFIGURATION_DESCRIPTOR)((ULONG_PTR)ConfigDescriptor + ConfigDescriptor->bLength);
|
||||
TmpDescriptor->bDescriptorType == USB_CONFIGURATION_DESCRIPTOR_TYPE && TmpDescriptor->bDescriptorType > 0;
|
||||
TmpDescriptor->bDescriptorType != USB_INTERFACE_DESCRIPTOR_TYPE && TmpDescriptor->bLength > 0;
|
||||
TmpDescriptor = (PUSB_CONFIGURATION_DESCRIPTOR)((ULONG_PTR)TmpDescriptor + TmpDescriptor->bLength))
|
||||
;
|
||||
|
||||
|
|
Loading…
Reference in a new issue