Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);