Fixed array overrun
authorSam Lantinga <slouken@libsdl.org>
Thu, 07 Feb 2008 16:14:43 +0000
changeset 2307 47f8a579cd9b
parent 2306 1a8bab15a45d
child 2308 514f7c1651fc
Fixed array overrun
src/events/SDL_keyboard_c.h
test/checkkeys.c
--- a/src/events/SDL_keyboard_c.h	Thu Feb 07 16:00:29 2008 +0000
+++ b/src/events/SDL_keyboard_c.h	Thu Feb 07 16:14:43 2008 +0000
@@ -37,7 +37,7 @@
     /* Data common to all keyboards */
     SDL_WindowID focus;
     Uint16 modstate;
-    Uint8 keystate[(SDL_NUM_SCANCODES + 7) / 8];
+    Uint8 keystate[SDL_NUM_SCANCODES];
     SDLKey keymap[SDL_NUM_SCANCODES];
 
     void *driverdata;
--- a/test/checkkeys.c	Thu Feb 07 16:00:29 2008 +0000
+++ b/test/checkkeys.c	Thu Feb 07 16:14:43 2008 +0000
@@ -63,8 +63,10 @@
                SDL_GetScancodeName(sym->scancode),
                sym->sym, SDL_GetKeyName(sym->sym));
     } else {
-        printf("Unknown Key (scancode = 0x%04X) %s ",
-               sym->scancode, pressed ? "pressed" : "released");
+        printf("Unknown Key (scancode = 0x%04X = %s) %s ",
+               sym->scancode,
+               SDL_GetScancodeName(sym->scancode),
+               pressed ? "pressed" : "released");
     }
 
     /* Print the translated character, if one exists */