projects
/
GitHub
/
LineageOS
/
G12
/
android_kernel_amlogic_linux-4.9.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1430ee7
)
HID: logitech-hidpp: add boundary check for name retrieval
author
Peter Wu
<peter@lekensteyn.nl>
Thu, 11 Dec 2014 12:51:19 +0000
(13:51 +0100)
committer
Jiri Kosina
<jkosina@suse.cz>
Thu, 11 Dec 2014 22:10:00 +0000
(23:10 +0100)
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>
drivers/hid/hid-logitech-hidpp.c
patch
|
blob
|
blame
|
history
diff --git
a/drivers/hid/hid-logitech-hidpp.c
b/drivers/hid/hid-logitech-hidpp.c
index 4d72c20fa233427e46de1655178cd850398e7da2..4292cc33c11974fc09ec82142f6cb74aa5084ea6 100644
(file)
--- a/
drivers/hid/hid-logitech-hidpp.c
+++ b/
drivers/hid/hid-logitech-hidpp.c
@@
-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;