Add checks to the endpoint and pipe configure functions and fail if the requested...
[pub/USBasp.git] / LUFA / Drivers / USB / Core / UC3 / Endpoint_UC3.h
index 3bd9c55..1356952 100644 (file)
                                                                      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) |