Add checks to the endpoint and pipe configure functions and fail if the requested...
[pub/USBasp.git] / LUFA / Drivers / USB / Core / XMEGA / Endpoint_XMEGA.h
index 8be20d2..3d2926c 100644 (file)
                        {
                                uint8_t EPConfigMask = (USB_EP_INTDSBL_bm | ((Banks > 1) ? USB_EP_PINGPONG_bm : 0) | Endpoint_BytesToEPSizeMask(Size));
 
+                               if ((Address & ENDPOINT_EPNUM_MASK) >= ENDPOINT_TOTAL_ENDPOINTS)
+                                 return false;
+
                                // TODO - Fix once limitations are lifted
-                               if ((Banks > 1) || (Size > 64))
+                               EPConfigMask &= ~USB_EP_PINGPONG_bm;
+                               if (Size > 64)
                                  return false;
 
                                switch (Type)