mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 01:59:43 +01:00
Prevent undefined behavior with integer under/overflow with help.Int()
It's possible that SDL_atoi() could call the libc atoi(), and if a string is provided that's too large to fit into an integer, then that would result in undefined behavior. To avoid this, use SDL_strtol() instead.
This commit is contained in:
parent
605b8a427c
commit
25f27d502a
1 changed files with 1 additions and 1 deletions
|
@ -106,7 +106,7 @@ int UtilityClass::Int(const char* str, int fallback /*= 0*/)
|
||||||
return fallback;
|
return fallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SDL_atoi(str);
|
return (int) SDL_strtol(str, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string UtilityClass::GCString(std::vector<SDL_GameControllerButton> buttons)
|
std::string UtilityClass::GCString(std::vector<SDL_GameControllerButton> buttons)
|
||||||
|
|
Loading…
Reference in a new issue