mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 17:38:16 +03: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:
@@ -106,7 +106,7 @@ int UtilityClass::Int(const char* str, int fallback /*= 0*/)
|
||||
return fallback;
|
||||
}
|
||||
|
||||
return SDL_atoi(str);
|
||||
return (int) SDL_strtol(str, NULL, 0);
|
||||
}
|
||||
|
||||
std::string UtilityClass::GCString(std::vector<SDL_GameControllerButton> buttons)
|
||||
|
||||
Reference in New Issue
Block a user