From d0a95fe03e69af14ebac190e709f51900257a2aa Mon Sep 17 00:00:00 2001 From: jah Date: Tue, 26 Nov 2013 00:11:09 +0000 Subject: [PATCH] determineScanGroupSize could cause a higher number of randomly generated hosts to be scanned than was requested with -iR N (for 0 < N < 16) because it didn't account for max_ips_to_scan. --- scan_engine.cc | 4 ++++ 1 file changed, 4 insertions(+) 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; }