mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-28 23:50:26 +09:00
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>
This commit is contained in:
parent
4feefdcfe9
commit
bdbcbe752e
@ -199,7 +199,7 @@ static int usb_kbd_translate(struct usb_kbd_pdata *data, unsigned char scancode,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((scancode > 0x1d) && (scancode < 0x3a)) {
|
if ((scancode > 0x1d) && (scancode < 0x39)) {
|
||||||
/* Shift pressed */
|
/* Shift pressed */
|
||||||
if (modifier & (LEFT_SHIFT | RIGHT_SHIFT))
|
if (modifier & (LEFT_SHIFT | RIGHT_SHIFT))
|
||||||
keycode = usb_kbd_numkey_shifted[scancode - 0x1e];
|
keycode = usb_kbd_numkey_shifted[scancode - 0x1e];
|
||||||
|
Loading…
Reference in New Issue
Block a user