]> granicus.if.org Git - neomutt/commitdiff
Revert write_one_header() to skip space and tab. (closes #3716)
authorKevin McCarthy <kevin@8t8.us>
Mon, 1 Dec 2014 22:19:24 +0000 (14:19 -0800)
committerKevin McCarthy <kevin@8t8.us>
Mon, 1 Dec 2014 22:19:24 +0000 (14:19 -0800)
This patch fixes CVE-2014-9116 in the stable branch.  It reverts
write_one_header() to the pre [f251d523ca5a] code for skipping
whitespace.

Thanks to Antonio Radici and Tomas Hoger for their analysis and patches
to mutt, which this patch is based off of.

sendlib.c

index cede8534f1066a14e6253a1685d76f0f3a023d90..f364f9f1eb374f0e5b0ebfb6ac9dbd80d216937e 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -1814,7 +1814,14 @@ static int write_one_header (FILE *fp, int pfxw, int max, int wraplen,
     {
       tagbuf = mutt_substrdup (start, t);
       /* skip over the colon separating the header field name and value */
-      t = skip_email_wsp(t + 1);
+      ++t;
+
+      /* skip over any leading whitespace (WSP, as defined in RFC5322)
+       * NOTE: skip_email_wsp() does the wrong thing here.
+       *       See tickets 3609 and 3716. */
+      while (*t == ' ' || *t == '\t')
+        t++;
+
       valbuf = mutt_substrdup (t, end);
     }
     dprint(4,(debugfile,"mwoh: buf[%s%s] too long, "