diff --git a/scan_engine.cc b/scan_engine.cc index 45d782f6a..0a52c1f50 100644 --- a/scan_engine.cc +++ b/scan_engine.cc @@ -2038,6 +2038,10 @@ int determineScanGroupSize(int hosts_scanned_so_far, groupsize = box(o.minHostGroupSz(), o.maxHostGroupSz(), groupsize); + if (o.max_ips_to_scan && (o.max_ips_to_scan - hosts_scanned_so_far) < groupsize) + // don't scan more randomly generated hosts than was specified + groupsize = o.max_ips_to_scan - hosts_scanned_so_far; + return groupsize; }