Skip to content

Commit a6e9c39

Browse files
CamilaAlvarezJiri Kosina
authored andcommitted
HID: cougar: fix slab-out-of-bounds Read in cougar_report_fixup
report_fixup for the Cougar 500k Gaming Keyboard was not verifying that the report descriptor size was correct before accessing it Reported-by: [email protected] Closes: https://syzkaller.appspot.com/bug?extid=24c0361074799d02c452 Signed-off-by: Camila Alvarez <[email protected]> Reviewed-by: Silvan Jegen <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent facdbdf commit a6e9c39

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/hid/hid-cougar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static void cougar_fix_g6_mapping(void)
106106
static __u8 *cougar_report_fixup(struct hid_device *hdev, __u8 *rdesc,
107107
unsigned int *rsize)
108108
{
109-
if (rdesc[2] == 0x09 && rdesc[3] == 0x02 &&
109+
if (*rsize >= 117 && rdesc[2] == 0x09 && rdesc[3] == 0x02 &&
110110
(rdesc[115] | rdesc[116] << 8) >= HID_MAX_USAGES) {
111111
hid_info(hdev,
112112
"usage count exceeds max: fixing up report descriptor\n");

0 commit comments

Comments
 (0)