mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-17 17:24:17 +08: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:
parent
1430ee73b5
commit
3a034a7a7d
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user