Skip to content

Commit

Permalink
ipts: prevent buffer-overflows by truncating HID reports
Browse files Browse the repository at this point in the history
  • Loading branch information
qzed committed Jan 28, 2020
1 parent 44c036b commit 8acf3f6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/misc/ipts/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,9 @@ int ipts_handle_hid_data(struct ipts_info *ipts,

switch (raw_header->data_type) {
case TOUCH_RAW_DATA_TYPE_HID_REPORT: {
if (raw_header->raw_data_size_bytes > HID_MAX_BUFFER_SIZE)
raw_header->raw_data_size_bytes = HID_MAX_BUFFER_SIZE;

memcpy(ipts->hid_input_report, raw_data,
raw_header->raw_data_size_bytes);

Expand Down

0 comments on commit 8acf3f6

Please sign in to comment.