From 049e9309637cd057689cf273b2023afb0d6876ae Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sat, 14 May 2011 02:17:58 +0000 Subject: Fixed possible invalid program execution when in host mode if corrupt descriptor lengths are supplied by the attached device. Minor code cleanups to add const and reformat where missing, as well as abstract out the internal device signature start address into a macro, so that it can be altered to suit particular devices within a single architecture if needed. Add missing documentation to the USB_Device_States_t enum. --- LUFA/Drivers/USB/Class/Common/HIDParser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'LUFA/Drivers/USB/Class/Common') diff --git a/LUFA/Drivers/USB/Class/Common/HIDParser.c b/LUFA/Drivers/USB/Class/Common/HIDParser.c index 20fceab64..b90f89eb2 100644 --- a/LUFA/Drivers/USB/Class/Common/HIDParser.c +++ b/LUFA/Drivers/USB/Class/Common/HIDParser.c @@ -351,7 +351,7 @@ uint16_t USB_GetHIDReportSize(HID_ReportInfo_t* const ParserData, uint16_t ReportSizeBits = ParserData->ReportIDSizes[i].ReportSizeBits[ReportType]; if (ParserData->ReportIDSizes[i].ReportID == ReportID) - return ((ReportSizeBits >> 3) + ((ReportSizeBits & 0x07) ? 1 : 0)); + return (ReportSizeBits / 8) + ((ReportSizeBits % 8) ? 1 : 0); } return 0; -- cgit v1.2.3