U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] usb: kbd: Prevent out of bound access
@ 2016-01-25 21:08 Marek Vasut
  2016-01-25 21:30 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Marek Vasut @ 2016-01-25 21:08 UTC (permalink / raw)
  To: u-boot

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>
---
 common/usb_kbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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];
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH] usb: kbd: Prevent out of bound access
  2016-01-25 21:08 [U-Boot] [PATCH] usb: kbd: Prevent out of bound access Marek Vasut
@ 2016-01-25 21:30 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2016-01-25 21:30 UTC (permalink / raw)
  To: u-boot

On Mon, Jan 25, 2016 at 10:08:50PM +0100, Marek Vasut wrote:

> 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>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
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>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-25 21:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-25 21:08 [U-Boot] [PATCH] usb: kbd: Prevent out of bound access Marek Vasut
2016-01-25 21:30 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox