mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-12 16:15:20 +02:00
Fix Irrlicht snprintf problems and UB in my_string_to_double
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user