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

win32/sendmail.c

index 82e8437a843e46d2c6a6536734fe3f22b9e6dc08..199a8f66df7d90ebc7daa45943c579073491417c 100644 (file)
@@ -883,11 +883,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 */