Skip to content

Commit

Permalink
HID: logitech-hidpp: add boundary check for name retrieval
Browse files Browse the repository at this point in the history
The HID response has a limited size. Do not trust the value returned by
hardware, check that it really fits in the message.

Signed-off-by: Peter Wu <[email protected]>
Reviewed-by: Benjamin Tissoires <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
  • Loading branch information
Lekensteyn authored and Jiri Kosina committed Dec 11, 2014
1 parent 1430ee7 commit 3a034a7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/hid/hid-logitech-hidpp.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ static char *hidpp_get_unifying_name(struct hidpp_device *hidpp_dev)

len = response.rap.params[1];

if (2 + len > sizeof(response.rap.params))
return NULL;

name = kzalloc(len + 1, GFP_KERNEL);
if (!name)
return NULL;
Expand Down

0 comments on commit 3a034a7

Please sign in to comment.