Add checks to the endpoint and pipe configure functions and fail if the requested endpoint or pipe number is above the maximum for that device.
This commit is contained in:
parent
9ab445518a
commit
c41bbf9fcc
6 changed files with 24 additions and 4 deletions
|
@ -208,7 +208,12 @@
|
|||
const uint16_t Size,
|
||||
const uint8_t Banks)
|
||||
{
|
||||
return Endpoint_ConfigureEndpoint_Prv((Address & ENDPOINT_EPNUM_MASK),
|
||||
uint8_t Number = (Address & ENDPOINT_EPNUM_MASK);
|
||||
|
||||
if (Number >= ENDPOINT_TOTAL_ENDPOINTS)
|
||||
return false;
|
||||
|
||||
return Endpoint_ConfigureEndpoint_Prv(Number,
|
||||
(AVR32_USBB_ALLOC_MASK |
|
||||
((uint32_t)Type << AVR32_USBB_EPTYPE_OFFSET) |
|
||||
((Address & ENDPOINT_DIR_IN) ? AVR32_USBB_UECFG0_EPDIR_MASK : 0) |
|
||||
|
|
|
@ -69,6 +69,9 @@ bool Pipe_ConfigurePipe(const uint8_t Address,
|
|||
uint8_t Number = (Address & PIPE_EPNUM_MASK);
|
||||
uint8_t Token = (Address & PIPE_DIR_IN) ? PIPE_TOKEN_IN : PIPE_TOKEN_OUT;
|
||||
|
||||
if (Number >= PIPE_TOTAL_PIPES)
|
||||
return false;
|
||||
|
||||
if (Type == EP_TYPE_CONTROL)
|
||||
Token = PIPE_TOKEN_SETUP;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue