diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-08-07 20:17:32 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2009-08-07 20:17:32 -0400 |
commit | 44cb2db10d05fc263c9fa44347d350d4f7f5890c (patch) | |
tree | 74fada50b6f2950279dbe8b771e3fc33d52f177c /drivers/hid/usbhid/hid-quirks.c | |
parent | 3c3301083e3bea4d14c597106c7b20b4b85fc03d (diff) |
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>
Diffstat (limited to 'drivers/hid/usbhid/hid-quirks.c')
-rw-r--r-- | drivers/hid/usbhid/hid-quirks.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index d8f7423f363e..0d9045aa2c4b 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -201,7 +201,7 @@ int usbhid_quirks_init(char **quirks_param) | |||
201 | u32 quirks; | 201 | u32 quirks; |
202 | int n = 0, m; | 202 | int n = 0, m; |
203 | 203 | ||
204 | for (; quirks_param[n] && n < MAX_USBHID_BOOT_QUIRKS; n++) { | 204 | for (; n < MAX_USBHID_BOOT_QUIRKS && quirks_param[n]; n++) { |
205 | 205 | ||
206 | m = sscanf(quirks_param[n], "0x%hx:0x%hx:0x%x", | 206 | m = sscanf(quirks_param[n], "0x%hx:0x%hx:0x%x", |
207 | &idVendor, &idProduct, &quirks); | 207 | &idVendor, &idProduct, &quirks); |