mirror of
https://github.com/nmap/nmap.git
synced 2025-12-11 10:19:03 +00:00
Avoid doing a calculation with an uninitialized tv_start if no timeout
has been specified.
This commit is contained in:
10
tcpip.cc
10
tcpip.cc
@@ -2233,8 +2233,14 @@ if (!pd) fatal("NULL packet device passed to %s", __func__);
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
gettimeofday(&tv_end, NULL);
|
long to_left;
|
||||||
long to_left = MAX(1, (to_usec - TIMEVAL_SUBTRACT(tv_end, tv_start)) / 1000);
|
|
||||||
|
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)
|
// Set the timeout (BUGBUG: this is cheating)
|
||||||
PacketSetReadTimeout(pd->adapter, to_left);
|
PacketSetReadTimeout(pd->adapter, to_left);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user