Fix error checking in agi::util::strtoi
Originally committed to SVN as r5499.
This commit is contained in:
parent
5a9fe91899
commit
64a3cc94ae
|
@ -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))
|
||||||
|
|
Loading…
Reference in a new issue