From c2b139e9bfcbffec7c5cbe9effbf4bf2e6b1b10a Mon Sep 17 00:00:00 2001 From: tudor Date: Sun, 14 Aug 2016 12:50:42 +0000 Subject: [PATCH] Avoiding target_needs_new_hostgroup calls seems to make ARP Ping crash so I reverted it. Also checked if Target.size() is not empty before doing Target[0] in nmap_main. --- nmap.cc | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/nmap.cc b/nmap.cc index 7fa66f3ea..245713e65 100644 --- a/nmap.cc +++ b/nmap.cc @@ -1750,8 +1750,6 @@ int nmap_main(int argc, char *argv[]) { char hostname[FQDN_LEN + 1] = ""; struct sockaddr_storage ss; size_t sslen; - int processed_hosts; - bool check_target; now = time(NULL); local_time = localtime(&now); @@ -1979,26 +1977,15 @@ int nmap_main(int argc, char *argv[]) { o.ping_group_sz = o.minHostGroupSz(); HostGroupState hstate(o.ping_group_sz, o.randomize_hosts, argc, (const char **) argv); - processed_hosts = 0; do { ideal_scan_group_sz = determineScanGroupSize(o.numhosts_scanned, &ports); - check_target = false; - if (processed_hosts == hstate.current_batch_sz) - processed_hosts = 0; - while (Targets.size() < ideal_scan_group_sz) { o.current_scantype = HOST_DISCOVERY; currenths = nexthost(&hstate, &exclude_group, &ports, o.pingtype); if (!currenths) break; - if (processed_hosts == hstate.current_batch_sz) { - check_target = true; - processed_hosts = 0; - } - processed_hosts++; - if (currenths->flags & HOST_UP && !o.listscan) o.numhosts_up++; @@ -2069,7 +2056,7 @@ int nmap_main(int argc, char *argv[]) { /* Hosts in a group need to be somewhat homogeneous. Put this host in the next group if necessary. See target_needs_new_hostgroup for the details of when we need to split. */ - if (check_target && target_needs_new_hostgroup(&Targets[0], Targets.size(), currenths)) { + if (Targets.size() && target_needs_new_hostgroup(&Targets[0], Targets.size(), currenths)) { returnhost(&hstate); o.numhosts_up--; break;