icmp: Correctly handle underflow in IcmpSendEcho().

This commit is contained in:
Gerald Pfeifer 2007-12-05 12:14:55 +01:00 committed by Alexandre Julliard
parent 8382eb01b2
commit 25301a76e6

View file

@ -433,8 +433,9 @@ DWORD WINAPI IcmpSendEcho(
* Decrease the timeout so that we don't enter an endless loop even * Decrease the timeout so that we don't enter an endless loop even
* if we get flooded with ICMP packets that are not for us. * if we get flooded with ICMP packets that are not for us.
*/ */
Timeout -= (recv_time - send_time); DWORD t = (recv_time - send_time);
if (Timeout < 0) Timeout = 0; if (Timeout > t) Timeout -= t;
else Timeout = 0;
continue; continue;
} else { } else {
/* This is a reply to our packet */ /* This is a reply to our packet */