Fixed array overrun
authorSam Lantinga <slouken@libsdl.org>
Thu, 07 Feb 2008 16:14:43 +0000
changeset 230747f8a579cd9b
parent 2306 1a8bab15a45d
child 2308 514f7c1651fc
Fixed array overrun
src/events/SDL_keyboard_c.h
test/checkkeys.c
     1.1 --- a/src/events/SDL_keyboard_c.h	Thu Feb 07 16:00:29 2008 +0000
     1.2 +++ b/src/events/SDL_keyboard_c.h	Thu Feb 07 16:14:43 2008 +0000
     1.3 @@ -37,7 +37,7 @@
     1.4      /* Data common to all keyboards */
     1.5      SDL_WindowID focus;
     1.6      Uint16 modstate;
     1.7 -    Uint8 keystate[(SDL_NUM_SCANCODES + 7) / 8];
     1.8 +    Uint8 keystate[SDL_NUM_SCANCODES];
     1.9      SDLKey keymap[SDL_NUM_SCANCODES];
    1.10  
    1.11      void *driverdata;
     2.1 --- a/test/checkkeys.c	Thu Feb 07 16:00:29 2008 +0000
     2.2 +++ b/test/checkkeys.c	Thu Feb 07 16:14:43 2008 +0000
     2.3 @@ -63,8 +63,10 @@
     2.4                 SDL_GetScancodeName(sym->scancode),
     2.5                 sym->sym, SDL_GetKeyName(sym->sym));
     2.6      } else {
     2.7 -        printf("Unknown Key (scancode = 0x%04X) %s ",
     2.8 -               sym->scancode, pressed ? "pressed" : "released");
     2.9 +        printf("Unknown Key (scancode = 0x%04X = %s) %s ",
    2.10 +               sym->scancode,
    2.11 +               SDL_GetScancodeName(sym->scancode),
    2.12 +               pressed ? "pressed" : "released");
    2.13      }
    2.14  
    2.15      /* Print the translated character, if one exists */