summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2025-07-08 09:51:02 +0700
committerHa Thach <[email protected]>2025-07-08 09:51:02 +0700
commit1a41445b17e11db9ab58a39488e4b0d9d85f0fd1 (patch)
treebbac22209a845a80158f39ec94ad99df2cf85581 /src
parent9d872d529ffa0aa53e735b24543c26156798fc64 (diff)
Fix HID descriptor parser size handling
Diffstat (limited to 'src')
-rw-r--r--src/class/hid/hid_host.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/class/hid/hid_host.c b/src/class/hid/hid_host.c
index 57e437196..b2b68e108 100644
--- a/src/class/hid/hid_host.c
+++ b/src/class/hid/hid_host.c
@@ -662,9 +662,9 @@ uint8_t tuh_hid_parse_report_descriptor(tuh_hid_report_info_t* report_info_arr,
uint8_t const tag = header.tag;
uint8_t const type = header.type;
- uint8_t const size = header.size;
+ uint8_t const size = (header.size == 3) ? 4 : header.size;
- uint8_t const data8 = desc_report[0];
+ uint8_t const data8 = (size > 0) ? desc_report[0] : 0;
TU_LOG(3, "tag = %d, type = %d, size = %d, data = ", tag, type, size);
for (uint32_t i = 0; i < size; i++) {