1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-31 18:31:04 +00:00

Fix Irrlicht snprintf problems and UB in my_string_to_double

This commit is contained in:
sfan5 2025-08-24 11:53:01 +02:00
parent baaab310fe
commit 079169612d
4 changed files with 6 additions and 12 deletions

View file

@ -1087,7 +1087,7 @@ std::optional<double> my_string_to_double(const std::string &s)
char *end = nullptr;
// Note: this also supports hexadecimal notation like "0x1.0p+1"
double number = std::strtod(s.c_str(), &end);
if (end != &*s.end())
if (end && *end != '\0')
return std::nullopt;
return number;
}