diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2012-06-10 19:53:20 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2012-06-10 19:53:20 +0000 |
commit | c41bbf9fccd99de70c962ec6f7cac15efe06d3df (patch) | |
tree | 05918c6da856132fe8a38324fc7a3cd88db14b63 /LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h | |
parent | 9ab445518a01e9b10b5d3e1c99f45d81d874278b (diff) | |
download | lufa-c41bbf9fccd99de70c962ec6f7cac15efe06d3df.tar.gz lufa-c41bbf9fccd99de70c962ec6f7cac15efe06d3df.tar.bz2 lufa-c41bbf9fccd99de70c962ec6f7cac15efe06d3df.zip |
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.
Diffstat (limited to 'LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h')
-rw-r--r-- | LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h b/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h index 3bd9c559c..1356952b3 100644 --- a/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h +++ b/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h @@ -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) | |