1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-10 09:49:05 +00:00

Avoid doing a calculation with an uninitialized tv_start if no timeout

has been specified.
This commit is contained in:
david
2009-08-24 21:32:01 +00:00
parent 6dc99d0e25
commit f09c8091a4

View File

@@ -2233,8 +2233,14 @@ if (!pd) fatal("NULL packet device passed to %s", __func__);
do {
#ifdef WIN32
gettimeofday(&tv_end, NULL);
long to_left = MAX(1, (to_usec - TIMEVAL_SUBTRACT(tv_end, tv_start)) / 1000);
long to_left;
if (to_usec > 0) {
gettimeofday(&tv_end, NULL);
to_left = MAX(1, (to_usec - TIMEVAL_SUBTRACT(tv_end, tv_start)) / 1000);
} else {
to_left = 1;
}
// Set the timeout (BUGBUG: this is cheating)
PacketSetReadTimeout(pd->adapter, to_left);
#endif