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:
parent
baaab310fe
commit
079169612d
4 changed files with 6 additions and 12 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue