1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-15 04:09:01 +00:00

o Moved the parse_long function from ncat to nbase for better reuse,

and used it to simplify netmask parsing code. This patch was
  contributed by William Pursell.
This commit is contained in:
david
2010-05-08 21:08:55 +00:00
parent 63c614e003
commit fea2ad0a33
2 changed files with 7 additions and 8 deletions

View File

@@ -187,17 +187,12 @@ int TargetGroup::parse_expr(const char * const target_expr, int af) {
*s = '\0'; /* Make sure target_net is terminated before the /## */
s++; /* Point s at the netmask */
if (!isdigit((int) (unsigned char) *s)) {
netmask_long = parse_long(s, (char**) &tail);
if (*tail != '\0' || tail == s || netmask_long < 0 || netmask_long > 32) {
error("Illegal netmask value, must be /0 - /32 . Assuming /32 (one host)");
netmask = 32;
} else {
netmask_long = strtol(s, (char**) &tail, 10);
if (*tail != '\0' || tail == s || netmask_long < 0 || netmask_long > 32) {
error("Illegal netmask value, must be /0 - /32 . Assuming /32 (one host)");
netmask = 32;
} else
} else
netmask = (u32) netmask_long;
}
} else
netmask = 32;
resolvedname = hostexp;