1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-03 21:29:01 +00:00

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.

This commit is contained in:
tudor
2016-08-14 12:50:42 +00:00
parent d5f7d5c45b
commit c2b139e9bf

15
nmap.cc
View File

@@ -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;