Skip to contentSkip to conversation

usb: kbd: Prevent out of bound access

PATCH New Marek Vasut 2 participants 2 messages Jan 25, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 common/usb_kbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/usb_kbd.c +1 -1
index cbb1995..d84865f 100644
@@ -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];
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 usb: kbd: Prevent out of bound access

Quoted 5 lines · Marek Vasut

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.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160125/82399c9d/attachment.sig>