mirror of https://gitee.com/openkylin/linux.git
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: Roel Kluin <roel.kluin@gmail.com> Cc: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
parent
3c3301083e
commit
44cb2db10d
|
@ -201,7 +201,7 @@ int usbhid_quirks_init(char **quirks_param)
|
|||
u32 quirks;
|
||||
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",
|
||||
&idVendor, &idProduct, &quirks);
|
||||
|
|
Loading…
Reference in New Issue