Fix error checking in agi::util::strtoi

Originally committed to SVN as r5499.
This commit is contained in:
Thomas Goyne 2011-07-26 19:51:28 +00:00
parent 5a9fe91899
commit 64a3cc94ae
1 changed files with 1 additions and 0 deletions

View File

@ -42,6 +42,7 @@ void str_lower(std::string &str) {
int strtoi(std::string &str) { int strtoi(std::string &str) {
errno = 0;
long l = strtol(str.c_str(), NULL, 10); long l = strtol(str.c_str(), NULL, 10);
if ((errno == ERANGE) || (l < INT_MIN) || (l > INT_MAX)) if ((errno == ERANGE) || (l < INT_MIN) || (l > INT_MAX))