projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
08f9572
)
HID: hid-cypress: validate length of report
author
Greg Kroah-Hartman
<
[email protected]
>
Fri, 6 Jan 2017 14:33:36 +0000
(15:33 +0100)
committer
Jiri Kosina
<
[email protected]
>
Fri, 6 Jan 2017 15:06:43 +0000
(16:06 +0100)
Make sure we have enough of a report structure to validate before
looking at it.
Reported-by: Benoit Camredon <
[email protected]
>
Tested-by: Benoit Camredon <
[email protected]
>
Cc: stable <
[email protected]
>
Signed-off-by: Greg Kroah-Hartman <
[email protected]
>
Signed-off-by: Jiri Kosina <
[email protected]
>
drivers/hid/hid-cypress.c
patch
|
blob
|
history
diff --git
a/drivers/hid/hid-cypress.c
b/drivers/hid/hid-cypress.c
index 1b764d1745f3daa693a17ee706c302ff31ae0f0e..1689568b597d4e5bb8824ccbe679f627525bf2a4 100644
(file)
--- a/
drivers/hid/hid-cypress.c
+++ b/
drivers/hid/hid-cypress.c
@@
-39,6
+39,9
@@
static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
if (!(quirks & CP_RDESC_SWAPPED_MIN_MAX))
return rdesc;
+ if (*rsize < 4)
+ return rdesc;
+
for (i = 0; i < *rsize - 4; i++)
if (rdesc[i] == 0x29 && rdesc[i + 2] == 0x19) {
rdesc[i] = 0x19;