From c41bbf9fccd99de70c962ec6f7cac15efe06d3df Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sun, 10 Jun 2012 19:53:20 +0000 Subject: 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. --- LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c') diff --git a/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c index 1ddffb51e..b64370835 100644 --- a/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c +++ b/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c @@ -66,6 +66,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; -- cgit v1.2.3