1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-15 20:29:03 +00:00

Fix assertion error when stats requested and 0 threads scheduled

This commit is contained in:
dmiller
2016-06-14 00:34:22 +00:00
parent 0141b8ed8e
commit 7a9ab13bee
2 changed files with 10 additions and 2 deletions

View File

@@ -1,5 +1,12 @@
# Nmap Changelog ($Id$); -*-text-*-
o [NSE] Fix a crash that happened when trying to print the percent done of 0
NSE script threads:
timing.cc:710 bool ScanProgressMeter::printStats(double, const timeval*): Assertion 'ltime' failed.
This would happen if no scripts were scheduled in a scan phase and the user
pressed a key or specified a short --stats-every interval. Reported by
Richard Petrie. [Daniel Miller]
o [NSE] ssl-enum-ciphers will give a failing score to any server with an RSA
certificate whose public key uses an exponent of 1. [Daniel Miller]

View File

@@ -958,7 +958,8 @@ local function run (threads_iter, hosts)
end
local nr, nw = table_size(running), table_size(waiting);
if cnse.key_was_pressed() then
-- total may be 0 if no scripts are running in this phase
if total > 0 and cnse.key_was_pressed() then
print_verbose(1, "Active NSE Script Threads: %d (%d waiting)",
nr+nw, nw);
progress("printStats", 1-(nr+nw)/total);
@@ -972,7 +973,7 @@ local function run (threads_iter, hosts)
(gsub(traceback(co), "\n", "\n\t")));
end
end
elseif progress "mayBePrinted" then
elseif total > 0 and progress "mayBePrinted" then
if verbosity() > 1 or debugging() > 0 then
progress("printStats", 1-(nr+nw)/total);
else