From bae46b677c13f8b5031371d878a1f286f7190a87 Mon Sep 17 00:00:00 2001 From: avolkov Date: Fri, 24 Nov 2006 14:59:25 +0000 Subject: [PATCH] Fixed potential b/o in vcontrol keyboard handler git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2529 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/sc2code/libs/input/sdl/vcontrol.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sc2/src/sc2code/libs/input/sdl/vcontrol.c b/sc2/src/sc2code/libs/input/sdl/vcontrol.c index e3bd5240f..483ac7cab 100644 --- a/sc2/src/sc2code/libs/input/sdl/vcontrol.c +++ b/sc2/src/sc2code/libs/input/sdl/vcontrol.c @@ -749,12 +749,20 @@ VControl_RemoveAllBindings () void VControl_ProcessKeyDown (SDLKey symbol) { + if ((symbol < 0) || (symbol >= SDLK_LAST)) { + log_add (log_Warning, "VControl: Got unknown key index %d", symbol); + return; + } + activate (bindings[symbol]); } void VControl_ProcessKeyUp (SDLKey symbol) { + if ((symbol < 0) || (symbol >= SDLK_LAST)) + return; + deactivate (bindings[symbol]); }