From 6940096a27d32090cd57e5f4234dbb0ce6b4aa1d Mon Sep 17 00:00:00 2001 From: david Date: Thu, 15 Apr 2010 22:42:13 +0000 Subject: [PATCH] Use atoi to parse the argument to --max-os-tries, not tval2msecs. The latter would allow you to do this: $ nmap --max-os-tries 1s localhost Bogus --max-os-tries argument specified, must be between 1 and 50 (inclusive) QUITTING! Because the "1s" became 1000. atoi isn't right for option parsing because it doesn't catch errors, but it's what the rest of the option parsing code uses. --- nmap.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nmap.cc b/nmap.cc index 9cbfacec0..6e01b28ca 100644 --- a/nmap.cc +++ b/nmap.cc @@ -762,7 +762,7 @@ int nmap_main(int argc, char *argv[]) { } else #endif if (optcmp(long_options[option_index].name, "max-os-tries") == 0) { - l = tval2msecs(optarg); + l = atoi(optarg); if (l < 1 || l > 50) fatal("Bogus --max-os-tries argument specified, must be between 1 and 50 (inclusive)"); o.setMaxOSTries(l);