Skip to content

Commit 844817e

Browse files
author
Jiri Kosina
committed
HID: picolcd: sanity check report size in raw_event() callback
The report passed to us from transport driver could potentially be arbitrarily large, therefore we better sanity-check it so that raw_data that we hold in picolcd_pending structure are always kept within proper bounds. Cc: [email protected] Reported-by: Steven Vittitoe <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent c54def7 commit 844817e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/hid/hid-picolcd_core.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,12 @@ static int picolcd_raw_event(struct hid_device *hdev,
350350
if (!data)
351351
return 1;
352352

353+
if (size > 64) {
354+
hid_warn(hdev, "invalid size value (%d) for picolcd raw event\n",
355+
size);
356+
return 0;
357+
}
358+
353359
if (report->id == REPORT_KEY_STATE) {
354360
if (data->input_keys)
355361
ret = picolcd_raw_keypad(data, report, raw_data+1, size-1);

0 commit comments

Comments
 (0)