Skip to content

Commit

Permalink
HID: fix overrun in quirks initialization
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Roel Kluin authored and Jiri Kosina committed Aug 8, 2009
1 parent 3c33010 commit 44cb2db
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hid/usbhid/hid-quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 44cb2db

Please sign in to comment.