Skip to content

Commit

Permalink
qnx: fixed potential buffer overflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jul 1, 2017
1 parent 22241ed commit 200f782
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/video/qnx/keyboard.c
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 200f782

Please sign in to comment.