1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-26 01:19:03 +00:00

Fixed broken --exclude in nmap.

--exclude 1.2.3.4,5.6.7.8 now works.
This commit is contained in:
colin
2011-06-21 18:05:25 +00:00
parent 5f99b2ad9e
commit dc4e67dffc

View File

@@ -186,9 +186,21 @@ int load_exclude_file(addrset *excludelist, FILE *fp) {
/* Load a comma-separated exclude list from a string, the argument to
--exclude. */
int load_exclude_string(addrset *excludelist, const char *s) {
if (!addrset_add_spec(excludelist, s, o.af(), 1)){
fatal("Invalid address specification: %s", s);
}
const char *begin, *p;
p = s;
while (*p != '\0') {
begin = p;
while (*p != '\0' && *p != ',')
p++;
const char * addr = std::string(begin, p - begin).c_str();
if (!addrset_add_spec(excludelist,addr, o.af(), 1)){
fatal("Invalid address specification: %s", addr);
}
if (*p == '\0')
break;
p++;
};
return 1;
}