Null termnate the pUserMappings variable to prevent memory corruption.
authorSam Lantinga <slouken@libsdl.org>
Fri, 28 Feb 2014 16:24:41 -0800
changeset 8267 3e857d08cd02
parent 8266 d123fc5d02bc
child 8268 3f8410f20405
Null termnate the pUserMappings variable to prevent memory corruption.
src/joystick/SDL_gamecontroller.c
--- a/src/joystick/SDL_gamecontroller.c	Fri Feb 28 14:23:41 2014 -0800
+++ b/src/joystick/SDL_gamecontroller.c	Fri Feb 28 16:24:41 2014 -0800
@@ -835,6 +835,7 @@
         char *pUserMappings = SDL_malloc( nchHints + 1 );
         char *pTempMappings = pUserMappings;
         SDL_memcpy( pUserMappings, hint, nchHints );
+        pUserMappings[nchHints] = '\0';
         while ( pUserMappings ) {
             char *pchNewLine = NULL;