From 200f782cabfa79c2cbac2147c7fc7bb7b39d45a9 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sat, 1 Jul 2017 19:52:12 -0400 Subject: [PATCH] qnx: fixed potential buffer overflow. --- src/video/qnx/keyboard.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/qnx/keyboard.c b/src/video/qnx/keyboard.c index 395457178e0d7..86c6395bafed1 100644 --- a/src/video/qnx/keyboard.c +++ b/src/video/qnx/keyboard.c @@ -30,7 +30,7 @@ * A map thta translates Screen key names to SDL scan codes. * This map is incomplete, but should include most major keys. */ -static int key_to_sdl[] = { +static int key_to_sdl[] = { [KEYCODE_SPACE] = SDL_SCANCODE_SPACE, [KEYCODE_APOSTROPHE] = SDL_SCANCODE_APOSTROPHE, [KEYCODE_COMMA] = SDL_SCANCODE_COMMA, @@ -107,7 +107,7 @@ handleKeyboardEvent(screen_event_t event) } // Skip unrecognized keys. - if ((val < 0) || (val > (sizeof(key_to_sdl) / sizeof(int)))) { + if ((val < 0) || (val >= SDL_TABLESIZE(key_to_sdl))) { return; }