From ab9345a896dc509a6414db44362a4833f24c2fa4 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 28 Feb 2014 16:24:41 -0800 Subject: [PATCH] Null termnate the pUserMappings variable to prevent memory corruption. --- src/joystick/SDL_gamecontroller.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c index 51ce040ca..fc44bdb93 100644 --- a/src/joystick/SDL_gamecontroller.c +++ b/src/joystick/SDL_gamecontroller.c @@ -835,6 +835,7 @@ SDL_GameControllerLoadHints() char *pUserMappings = SDL_malloc( nchHints + 1 ); char *pTempMappings = pUserMappings; SDL_memcpy( pUserMappings, hint, nchHints ); + pUserMappings[nchHints] = '\0'; while ( pUserMappings ) { char *pchNewLine = NULL;