Make sure the string is terminated, fixed invalid read in SDL_PrivateGameControllerParseControllerConfigString()
(cherry picked from commit 312f98c2a1
)
This commit is contained in:
parent
e7c4575719
commit
3a8032f491
1 changed files with 2 additions and 0 deletions
|
@ -1066,6 +1066,7 @@ static void SDL_PrivateGameControllerParseControllerConfigString(SDL_GameControl
|
||||||
|
|
||||||
} else if (bGameButton) {
|
} else if (bGameButton) {
|
||||||
if (i >= sizeof(szGameButton)) {
|
if (i >= sizeof(szGameButton)) {
|
||||||
|
szGameButton[sizeof(szGameButton) - 1] = '\0';
|
||||||
SDL_SetError("Button name too large: %s", szGameButton);
|
SDL_SetError("Button name too large: %s", szGameButton);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1073,6 +1074,7 @@ static void SDL_PrivateGameControllerParseControllerConfigString(SDL_GameControl
|
||||||
i++;
|
i++;
|
||||||
} else {
|
} else {
|
||||||
if (i >= sizeof(szJoystickButton)) {
|
if (i >= sizeof(szJoystickButton)) {
|
||||||
|
szJoystickButton[sizeof(szJoystickButton) - 1] = '\0';
|
||||||
SDL_SetError("Joystick button name too large: %s", szJoystickButton);
|
SDL_SetError("Joystick button name too large: %s", szJoystickButton);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue