dlls/icmp/icmp_main.c -- attempt at fixing regression in r1.30 (RESEND)

Gerald Pfeifer gerald at pfeifer.com
Wed Dec 5 05:14:55 CST 2007


On Wed, 5 Dec 2007, Alexandre Julliard wrote:
> Looks ok, please submit the patch with a proper Changelog entry.

Thanks for looking into this!  Here we go! :-)

Gerald

ChangeLog:
Correctly handle underflow in IcmpSendEcho(); bug introduced in rev 1.30.

Index: dlls/icmp/icmp_main.c
===================================================================
RCS file: /home/wine/wine/dlls/icmp/icmp_main.c,v
retrieving revision 1.30
diff -u -3 -p -r1.30 icmp_main.c
--- dlls/icmp/icmp_main.c	6 Nov 2006 11:51:07 -0000	1.30
+++ dlls/icmp/icmp_main.c	22 Nov 2007 21:28:59 -0000
@@ -433,8 +433,9 @@ DWORD WINAPI IcmpSendEcho(
              * 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.
              */
-            Timeout -= (recv_time - send_time);
-            if (Timeout < 0) Timeout = 0;
+            DWORD t = (recv_time - send_time);
+            if (Timeout > t) Timeout -= t;
+            else             Timeout = 0;
             continue;
         } else {
             /* This is a reply to our packet */



More information about the wine-patches mailing list