diff --git a/src/vnm/AddressRange.cc b/src/vnm/AddressRange.cc index ca0987e552..c3f3cfbf72 100644 --- a/src/vnm/AddressRange.cc +++ b/src/vnm/AddressRange.cc @@ -641,6 +641,11 @@ int AddressRange::ip_to_i(const string& _ip, unsigned int& i_ip) const return -1; } + if ( ip.find_first_not_of("0123456789 ") != std::string::npos ) + { + return -1; + } + iss.str(ip); i_ip = 0; @@ -649,7 +654,7 @@ int AddressRange::ip_to_i(const string& _ip, unsigned int& i_ip) const { iss >> dec >> tmp >> ws; - if ( tmp > 255 ) + if ( tmp > 255 || iss.fail() ) { return -1; }