aboutsummaryrefslogtreecommitdiff
path: root/LUFA/Drivers/USB/Class/Common/HIDParser.c
diff options
context:
space:
mode:
authorDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2011-05-14 02:17:58 +0000
committerDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2011-05-14 02:17:58 +0000
commitad45a635b597ae81ac8ffcfd243713cb6847d710 (patch)
tree184919dd3e728aad41bc3bb1567b6f95f18564aa /LUFA/Drivers/USB/Class/Common/HIDParser.c
parent4e6393f01836c706fec58958b6faab42f1262d3f (diff)
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. git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@1752 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'LUFA/Drivers/USB/Class/Common/HIDParser.c')
-rw-r--r--LUFA/Drivers/USB/Class/Common/HIDParser.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/LUFA/Drivers/USB/Class/Common/HIDParser.c b/LUFA/Drivers/USB/Class/Common/HIDParser.c
index 20fceab6..b90f89eb 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;