mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-11-24 22:34:21 +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:
1 parent
605b8a427c
commit
25f27d502a
1 file changed
+1
-1
@@ -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