* - Fixed void pointer arithmetic in the low level and class driver RNDIS demo protocol decoders
* - Fixed low level RNDIS demo incorrectly setting the RNDIS state when a null packet filter was requested
* - Fixed missing entries in several project's Atmel Studio integration files, such as driver INF files
+ * - Fixed invalid endpoint indexes causing memory corruption in device Clear/Set Feature standard requests (thanks to Peter Popovec)
*
* <b>Changed:</b>
* - Added signed alternative libUSB driver for the AVRISP-MKII clone project, to support Atmel Studio 7 (thanks to Atmel)
switch (USB_ControlRequest.bmRequestType)
{
case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE):
+ {
#if !defined(NO_DEVICE_SELF_POWER)
if (USB_Device_CurrentlySelfPowered)
CurrentStatus |= FEATURE_SELFPOWERED_ENABLED;
CurrentStatus |= FEATURE_REMOTE_WAKEUP_ENABLED;
#endif
break;
+ }
case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT):
+ {
#if !defined(CONTROL_ONLY_DEVICE)
- Endpoint_SelectEndpoint((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);
+ uint8_t EndpointIndex = ((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);
+
+ if (EndpointIndex >= ENDPOINT_TOTAL_ENDPOINTS)
+ return;
+
+ Endpoint_SelectEndpoint(EndpointIndex);
CurrentStatus = Endpoint_IsStalled();
#endif
break;
+ }
default:
return;
}
{
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
case REQREC_DEVICE:
+ {
if ((uint8_t)USB_ControlRequest.wValue == FEATURE_SEL_DeviceRemoteWakeup)
USB_Device_RemoteWakeupEnabled = (USB_ControlRequest.bRequest == REQ_SetFeature);
else
return;
break;
+ }
#endif
#if !defined(CONTROL_ONLY_DEVICE)
case REQREC_ENDPOINT:
+ {
if ((uint8_t)USB_ControlRequest.wValue == FEATURE_SEL_EndpointHalt)
{
uint8_t EndpointIndex = ((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);
- if (EndpointIndex == ENDPOINT_CONTROLEP)
+ if (EndpointIndex == ENDPOINT_CONTROLEP || EndpointIndex >= ENDPOINT_TOTAL_ENDPOINTS)
return;
Endpoint_SelectEndpoint(EndpointIndex);
}
break;
+ }
#endif
default:
return;