You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
HID: logitech-hidpp: add boundary check for name retrieval
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 <peter@lekensteyn.nl> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user