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;