Commit bdbcbe752e93357226cba12a6ce00bbe54cb5db8

Authored by Marek Vasut
1 parent 4feefdcfe9

usb: kbd: Prevent out of bound access

Scan code 0x39 is CapsLock, which is not a printable character and thus
is not covered by either usb_kbd_numkey_shifted[] or usb_kbd_numkey[].
Fix the scan code check to avoid looking it up in either of the arrays.

Signed-off-by: Marek Vasut <marex@denx.de>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

... ... @@ -199,7 +199,7 @@
199 199 }
200 200 }
201 201  
202   - if ((scancode > 0x1d) && (scancode < 0x3a)) {
  202 + if ((scancode > 0x1d) && (scancode < 0x39)) {
203 203 /* Shift pressed */
204 204 if (modifier & (LEFT_SHIFT | RIGHT_SHIFT))
205 205 keycode = usb_kbd_numkey_shifted[scancode - 0x1e];