summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authorskidau <skidau@gmail.com>2011-12-29 12:05:36 +1100
committerskidau <skidau@gmail.com>2011-12-29 12:05:36 +1100
commit1df7af35e994f651cd628a9cc5c11745381a1cb7 (patch)
treeb773a21fbed7be513cfa2db5f81a01c00ab37422 /Source/Core/Common
parentaf8a866afc201ae2c79a45321faadcbfa8a93f2a (diff)
Reset errno to zero before testing it after the strtoul call. Fixes issue 5078.
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/Src/StringUtil.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Source/Core/Common/Src/StringUtil.cpp b/Source/Core/Common/Src/StringUtil.cpp
index cdd1016210..664987d350 100644
--- a/Source/Core/Common/Src/StringUtil.cpp
+++ b/Source/Core/Common/Src/StringUtil.cpp
@@ -125,6 +125,10 @@ std::string StripQuotes(const std::string& s)
bool TryParse(const std::string &str, u32 *const output)
{
char *endptr = NULL;
+
+ // Reset errno to a value other than ERANGE
+ errno = 0;
+
unsigned long value = strtoul(str.c_str(), &endptr, 0);
if (!endptr || *endptr)