Skip to content

Commit 2f1763f

Browse files
dlelcldkeksleleJiri Kosina
authored andcommitted
HID: wacom: fix out-of-bounds read in wacom_intuos_bt_irq
The wacom_intuos_bt_irq() function processes Bluetooth HID reports without sufficient bounds checking. A maliciously crafted short report can trigger an out-of-bounds read when copying data into the wacom structure. Specifically, report 0x03 requires at least 22 bytes to safely read the processed data and battery status, while report 0x04 (which falls through to 0x03) requires 32 bytes. Add explicit length checks for these report IDs and log a warning if a short report is received. Signed-off-by: Benoît Sevens <bsevens@google.com> Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent e31b556 commit 2f1763f

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

drivers/hid/wacom_wac.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,10 +1208,20 @@ static int wacom_intuos_bt_irq(struct wacom_wac *wacom, size_t len)
12081208

12091209
switch (data[0]) {
12101210
case 0x04:
1211+
if (len < 32) {
1212+
dev_warn(wacom->pen_input->dev.parent,
1213+
"Report 0x04 too short: %zu bytes\n", len);
1214+
break;
1215+
}
12111216
wacom_intuos_bt_process_data(wacom, data + i);
12121217
i += 10;
12131218
fallthrough;
12141219
case 0x03:
1220+
if (i == 1 && len < 22) {
1221+
dev_warn(wacom->pen_input->dev.parent,
1222+
"Report 0x03 too short: %zu bytes\n", len);
1223+
break;
1224+
}
12151225
wacom_intuos_bt_process_data(wacom, data + i);
12161226
i += 10;
12171227
wacom_intuos_bt_process_data(wacom, data + i);

0 commit comments

Comments
 (0)