<<< Date Index >>>     <<< Thread Index >>>

[PATCH] PGP decryption mangles one line



I discovered that the first line of PGP encrypted messages wasn't
shown in some(all?) cases.. mutt_read_mime_header use in
pgp_decrypt_part as it currently stands has an obvious problem.

Suggested patch attached.  Please Cc.
-- 
Ragnar Hojland - Project Manager
Linalco "Specialists in Linux and Free Software"
http://www.linalco.com  Tel: +34-91-4561700


--- mutt-1.5.6/parse.c.O        2004-08-20 01:00:30.134563616 +0200
+++ mutt-1.5.6/parse.c  2004-08-20 01:06:35.018092888 +0200
@@ -428,8 +428,14 @@ BODY *mutt_read_mime_header (FILE *fp, i
   p->type        = digest ? TYPEMESSAGE : TYPETEXT;
   p->disposition = DISPINLINE;
   
-  while (*(line = read_rfc822_line (fp, line, &linelen)) != 0)
+  while (1)
   {
+     int prev_offset = ftell(fp);
+     if (*(line = read_rfc822_line (fp, line, &linelen)) == 0)
+     {
+       break;
+     }
+     
     /* Find the value of the current header */
     if ((c = strchr (line, ':')))
     {
@@ -444,6 +450,7 @@ BODY *mutt_read_mime_header (FILE *fp, i
     }
     else
     {
+      fseek (fp, prev_offset, SEEK_SET);
       dprint (1, (debugfile, "read_mime_header: bogus MIME header: %s\n", 
line));
       break;
     }
@@ -480,6 +487,7 @@ BODY *mutt_read_mime_header (FILE *fp, i
 #endif
   }
   p->offset = ftell (fp); /* Mark the start of the real data */
+
   if (p->type == TYPETEXT && !p->subtype)
     p->subtype = safe_strdup ("plain");
   else if (p->type == TYPEMESSAGE && !p->subtype)