]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug #22947 (Ack() inside win32/sendmail.c may stall in certain
authorIlia Alshanetsky <iliaa@php.net>
Mon, 11 Aug 2003 18:08:35 +0000 (18:08 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 11 Aug 2003 18:08:35 +0000 (18:08 +0000)
situations). (Ilia)

NEWS
win32/sendmail.c

diff --git a/NEWS b/NEWS
index bf248f76755eaadf8f507321a40aff5fda4150ee..c63fca2221e1846749f04e2725814cc13f16881c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,8 @@ PHP 4                                                                      NEWS
 - Fixed bug #24142 (workaround for a gcc bug affecting round()). (Marcus, Ilia)
 - Fixed bug #24063 (serialize() missing 0 after the . on scientific notation).
   (Marcus, Ilia)
+- Fixed bug #22947 (Ack() inside win32/sendmail.c may stall in certain
+  situations). (Ilia)
 - Fixed bug #21957 (serialize() mangles objects with __sleep). (Ilia)
 
 07 Aug 2003, Version 4.3.3RC3
index 7cdc3a3190e4a5c3aed5314883d4a1348831e05e..855873c5de141b4acd83cfc6c81e3288ecdfe0bd 100644 (file)
@@ -856,11 +856,11 @@ int Ack(char **server_response)
        /* Check for newline */
        Index += rlen;
        
-       if ((buf[Received - 4] == ' ' && buf[Received - 3] == '-') ||
-           (buf[Received - 2] != '\r') || (buf[Received - 1] != '\n'))
-               /* err_msg          fprintf(stderr,"Incomplete server message. Awaiting CRLF\n"); */
-               goto again;                             /* Incomplete data. Line must be terminated by CRLF
-                                          And not contain a space followed by a '-' */
+       /* SMPT RFC says \r\n is the only valid line ending, who are we to argue ;)
+        * The response code must contain at least 5 characters ex. 220\r\n */
+       if (Received < 5 || buf[Received - 1] != '\n' || buf[Received - 2] != '\r') {
+               goto again;
+       }
 
        if (buf[0] > '3') {
                /* If we've a valid pointer, return the SMTP server response so the error message contains more information */