From 0b4813534e52eeb466bc63adb755df0cfe3c04d4 Mon Sep 17 00:00:00 2001 From: mcmartin Date: Sat, 13 Jan 2007 01:37:15 +0000 Subject: [PATCH] D'oh; missed a check in previous patch git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2660 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/sc2code/libs/input/sdl/input.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sc2/src/sc2code/libs/input/sdl/input.c b/sc2/src/sc2code/libs/input/sdl/input.c index d70cdceab..569cda1f3 100644 --- a/sc2/src/sc2code/libs/input/sdl/input.c +++ b/sc2/src/sc2code/libs/input/sdl/input.c @@ -209,7 +209,7 @@ TFB_InitInput (int driver, int flags) SDL_EnableUNICODE(1); (void)SDL_GetKeyState (&num_keys); - kbdstate = (int *)HMalloc (sizeof (int) * num_keys); + kbdstate = (int *)HMalloc (sizeof (int) * (num_keys + 1)); #ifdef HAVE_JOYSTICK @@ -327,8 +327,8 @@ ProcessInputEvent (const SDL_Event *Event) SDLKey k = Event->key.keysym.sym; wchar_t map_key = Event->key.keysym.unicode; - if (k < 0 || k > SDLK_LAST) - k = SDLK_LAST; // for unknown keys + if (k < 0 || k > num_keys) + k = num_keys; // for unknown keys if (Event->type == SDL_KEYDOWN) {