diff options
Diffstat (limited to 'Demos/Host')
-rw-r--r-- | Demos/Host/ClassDriver/CDCHost/CDCHost.c | 13 | ||||
-rw-r--r-- | Demos/Host/ClassDriver/MouseHost/MouseHost.c | 13 |
2 files changed, 6 insertions, 20 deletions
diff --git a/Demos/Host/ClassDriver/CDCHost/CDCHost.c b/Demos/Host/ClassDriver/CDCHost/CDCHost.c index b74c39418..291e8359e 100644 --- a/Demos/Host/ClassDriver/CDCHost/CDCHost.c +++ b/Demos/Host/ClassDriver/CDCHost/CDCHost.c @@ -77,17 +77,10 @@ int main(void) uint16_t ConfigDescriptorSize;
uint8_t ConfigDescriptorData[512];
- if (USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, NULL) != HOST_SENDCONTROL_Successful)
+ if ((USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, NULL) != HOST_SENDCONTROL_Successful) ||
+ (ConfigDescriptorSize > sizeof(ConfigDescriptorData)))
{
- printf("Error Retrieving Device Descriptor.\r\n");
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
- USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- break;
- }
-
- if (ConfigDescriptorSize > 512)
- {
- printf("Device Descriptor Too Large To Process.\r\n");
+ printf("Error Retrieving Configuration Descriptor.\r\n");
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
diff --git a/Demos/Host/ClassDriver/MouseHost/MouseHost.c b/Demos/Host/ClassDriver/MouseHost/MouseHost.c index c2850cfec..6913ec3cb 100644 --- a/Demos/Host/ClassDriver/MouseHost/MouseHost.c +++ b/Demos/Host/ClassDriver/MouseHost/MouseHost.c @@ -79,22 +79,15 @@ int main(void) uint16_t ConfigDescriptorSize;
uint8_t ConfigDescriptorData[512];
- if (USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, NULL) != HOST_SENDCONTROL_Successful)
+ if ((USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, NULL) != HOST_SENDCONTROL_Successful) ||
+ (ConfigDescriptorSize > sizeof(ConfigDescriptorData)))
{
- printf("Error Retrieving Device Descriptor.\r\n");
+ printf("Error Retrieving Configuration Descriptor.\r\n");
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
- if (ConfigDescriptorSize > 512)
- {
- printf("Device Descriptor Too Large To Process.\r\n");
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
- USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- break;
- }
-
USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData);
if (HID_Host_ConfigurePipes(&Mouse_HID_Interface,
|