Commit 44cb2db1 authored by Roel Kluin's avatar Roel Kluin Committed by Jiri Kosina

HID: fix overrun in quirks initialization

Check whether index is within bounds before testing the element.

declared in drivers/hid/usbhid/hid-core.c:62:
static char *quirks_param[MAX_USBHID_BOOT_QUIRKS] = ...
Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 3c330108
...@@ -201,7 +201,7 @@ int usbhid_quirks_init(char **quirks_param) ...@@ -201,7 +201,7 @@ int usbhid_quirks_init(char **quirks_param)
u32 quirks; u32 quirks;
int n = 0, m; int n = 0, m;
for (; quirks_param[n] && n < MAX_USBHID_BOOT_QUIRKS; n++) { for (; n < MAX_USBHID_BOOT_QUIRKS && quirks_param[n]; n++) {
m = sscanf(quirks_param[n], "0x%hx:0x%hx:0x%x", m = sscanf(quirks_param[n], "0x%hx:0x%hx:0x%x",
&idVendor, &idProduct, &quirks); &idVendor, &idProduct, &quirks);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment