pvxvct IP range parsing

This commit is contained in:
Michael Davidsaver
2024-10-13 19:26:45 -07:00
parent a7d761d507
commit dfd568e64e
+1 -1
View File
@@ -64,7 +64,7 @@ parsePeer(const char *optarg)
// only # of bits. eg. "/24"
std::istringstream strm(match[2].str());
unsigned nbit=0;
if((strm>>nbit).good()) {
if(!(strm>>nbit).good() || nbit>32) {
throw std::runtime_error(pva::SB()<<"Expected number of bits. not "<<match[2]);
}
mask.s_addr = htonl(0xffffffff<<(32-nbit));