Reset errno to zero before testing it after the strtoul call. Fixes issue 5078.
This commit is contained in:
parent
af8a866afc
commit
1df7af35e9
|
@ -125,6 +125,10 @@ std::string StripQuotes(const std::string& s)
|
||||||
bool TryParse(const std::string &str, u32 *const output)
|
bool TryParse(const std::string &str, u32 *const output)
|
||||||
{
|
{
|
||||||
char *endptr = NULL;
|
char *endptr = NULL;
|
||||||
|
|
||||||
|
// Reset errno to a value other than ERANGE
|
||||||
|
errno = 0;
|
||||||
|
|
||||||
unsigned long value = strtoul(str.c_str(), &endptr, 0);
|
unsigned long value = strtoul(str.c_str(), &endptr, 0);
|
||||||
|
|
||||||
if (!endptr || *endptr)
|
if (!endptr || *endptr)
|
||||||
|
|
Loading…
Reference in New Issue