]> Pileus Git - ~andy/fetchmail/commitdiff
Ready to ship.
authorEric S. Raymond <esr@thyrsus.com>
Tue, 26 Nov 2002 04:05:38 +0000 (04:05 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 26 Nov 2002 04:05:38 +0000 (04:05 -0000)
svn path=/trunk/; revision=3771

NEWS
transact.c

diff --git a/NEWS b/NEWS
index 912ca74fd1666555487a62d4060d534a055b3a48..a81298ac7447c62d90156b9985c6372a19543f26 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@
 * Configure.in update for autoconf 2.5 (Art Haas). 
 * Be case-insensitive when looking for IMAP responses.
 * Fix logout-after-idle-delivery bug (Sunil Shetye).
+* Sunil Shetye's patch to bulletproof end-of-header detection.
 
 fetchmail-6.1.2 (Thu Oct 31 11:41:02 EST 2002), 22135 lines:
 
index 5ddcba991b56cc40fec41968efdf9de2a29ab53b..f419828e34ab5c26b3a8819b8d8d14a1dd90e039 100644 (file)
@@ -339,6 +339,14 @@ static int sizeticker;
 
 #define EMPTYLINE(s)   ((s)[0] == '\r' && (s)[1] == '\n' && (s)[2] == '\0')
 
+static int end_of_header (const char *s)
+/* accept "\r*\n" as EOH in order to be bulletproof against broken survers */
+{
+    while (s[0] == '\r')
+       s++;
+    return (s[0] == '\n' && s[1] == '\0');
+}
+
 int readheaders(int sock,
                       long fetchlen,
                       long reallen,
@@ -476,7 +484,7 @@ int readheaders(int sock,
                }
 
            /* check for end of headers */
-           if (EMPTYLINE(line))
+           if (end_of_header(line))
            {
                headers_ok = TRUE;
                has_nuls = (linelen != strlen(line));
@@ -506,10 +514,12 @@ int readheaders(int sock,
             */
            if (!isspace(line[0]) && !strchr(line, ':'))
            {
-               headers_ok = FALSE;
-               has_nuls = (linelen != strlen(line));
-               free(line);
-               goto process_headers;
+               /* the headers_ok flag cannot be set to FALSE here as the
+                * delimiter has not occurred yet. */
+               if (outlevel > O_SILENT)
+                   report(stdout,
+                          GT_("incorrect header line found while scanning headers\n"));
+               retain_mail = 1;
            }
 
            /* check for RFC822 continuations */