summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2016-01-25 22:00:44 +0100
committerMarek Vasut <marex@denx.de>2016-01-25 22:00:46 +0100
commitbdbcbe752e93357226cba12a6ce00bbe54cb5db8 (patch)
treeba459034dfe6eb16ebbf4dd1b1fb57f70cad58e3 /common
parent4feefdcfe916113ac6e1837ea22857f25fe1771c (diff)
downloadu-boot-imx-bdbcbe752e93357226cba12a6ce00bbe54cb5db8.zip
u-boot-imx-bdbcbe752e93357226cba12a6ce00bbe54cb5db8.tar.gz
u-boot-imx-bdbcbe752e93357226cba12a6ce00bbe54cb5db8.tar.bz2
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>
Diffstat (limited to 'common')
-rw-r--r--common/usb_kbd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index cbb1995..d84865f 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -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 */
if (modifier & (LEFT_SHIFT | RIGHT_SHIFT))
keycode = usb_kbd_numkey_shifted[scancode - 0x1e];