Nmap Development mailing list archives

Re: Packet rate logging and division by zero


From: David Fifield <david () bamsoftware com>
Date: Tue, 16 Dec 2008 20:07:22 -0700

On Wed, Dec 17, 2008 at 01:39:40AM +0000, jah wrote:
Hi folks,

Overall sending rates: *1.#J* packets / s.

I've only been able to reproduce this on windows and it's fairly easy to
do with a connect scan to localhost (it doesn't always happen).  It
occurs before any packets are sent at the start of a scan after TIMING
STATS are printed.

double RateMeter::getOverallRate(const struct timeval *now) const {
  return total / elapsedTime(now);
}

if elapsedTime() returns 0, then RateMeter::getOverallRate returns
double "1.#INF000000000000" which somehow is turned into 1.#J by a %.2f
format string.

The attached timing.cc.patch will prevent division by zero and instead
return 0.

Good job, your fix is correct and I have applied it.

David Fifield

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: