diff --git a/nmap.cc b/nmap.cc index bbc2fb0a7..de3732387 100644 --- a/nmap.cc +++ b/nmap.cc @@ -2094,7 +2094,7 @@ int nmap_main(int argc, char *argv[]) { if (o.ping_group_sz < o.minHostGroupSz()) o.ping_group_sz = o.minHostGroupSz(); HostGroupState hstate(o.ping_group_sz, o.randomize_hosts, - o.generate_random_ips ? o.max_ips_to_scan : 0, argc, (const char **) argv); + o.generate_random_ips, o.max_ips_to_scan, argc, (const char **) argv); do { ideal_scan_group_sz = determineScanGroupSize(o.numhosts_scanned, &ports); diff --git a/targets.cc b/targets.cc index e95462125..119deca59 100644 --- a/targets.cc +++ b/targets.cc @@ -285,7 +285,7 @@ bool target_needs_new_hostgroup(Target **targets, int targets_sz, const Target * The target_expressions array MUST REMAIN VALID IN MEMORY as long as this class instance is used -- the array is NOT copied. */ -HostGroupState::HostGroupState(int lookahead, int rnd, unsigned long num_random, int argc, const char **argv) { +HostGroupState::HostGroupState(int lookahead, int rnd, bool gen_rand, unsigned long num_random, int argc, const char **argv) { assert(lookahead > 0); this->argc = argc; this->argv = argv; @@ -296,7 +296,7 @@ HostGroupState::HostGroupState(int lookahead, int rnd, unsigned long num_random, current_batch_sz = 0; next_batch_no = 0; randomize = rnd; - if (num_random >= 0) { + if (gen_rand) { current_group.generate_random_ips(num_random); } } diff --git a/targets.h b/targets.h index 628c10a9c..63a6c473a 100644 --- a/targets.h +++ b/targets.h @@ -74,7 +74,7 @@ public: /* The maximum number of entries we want to allow storing in defer_buffer. */ static const unsigned int DEFER_LIMIT = 64; - HostGroupState(int lookahead, int randomize, unsigned long num_random, int argc, const char *argv[]); + HostGroupState(int lookahead, int randomize, bool gen_rand, unsigned long num_random, int argc, const char *argv[]); ~HostGroupState(); Target **hostbatch;