mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-03 16:36:25 +00:00
Make sure the string is terminated, fixed invalid read in SDL_PrivateParseGamepadConfigString()
This commit is contained in:
@@ -1282,12 +1282,14 @@ static int SDL_PrivateParseGamepadConfigString(SDL_Gamepad *gamepad, const char
|
||||
|
||||
} else if (bGameButton) {
|
||||
if (i >= sizeof(szGameButton)) {
|
||||
szGameButton[sizeof(szGameButton) - 1] = '\0';
|
||||
return SDL_SetError("Button name too large: %s", szGameButton);
|
||||
}
|
||||
szGameButton[i] = *pchPos;
|
||||
i++;
|
||||
} else {
|
||||
if (i >= sizeof(szJoystickButton)) {
|
||||
szJoystickButton[sizeof(szJoystickButton) - 1] = '\0';
|
||||
return SDL_SetError("Joystick button name too large: %s", szJoystickButton);
|
||||
}
|
||||
szJoystickButton[i] = *pchPos;
|
||||
|
Reference in New Issue
Block a user