]> granicus.if.org Git - mutt/commitdiff
fix problem where mutt_substrdup() was called with the start
authorMichael Elkins <me@sigpipe.org>
Tue, 18 Dec 2012 10:21:57 +0000 (02:21 -0800)
committerMichael Elkins <me@sigpipe.org>
Tue, 18 Dec 2012 10:21:57 +0000 (02:21 -0800)
pointer > end pointer, as a result of using SKIPWS().  This
occurred because the header field had an empty body, so the
trailing newline was skipped over.  The fix is to just skip over
ascii space and htab.

closes #3609

sendlib.c

index 249d6a1d18ed5fae49603db16e20fc6297d4b6de..44382602f1eefcb5b9f29f36df47e475b8194bdc 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -1814,7 +1814,11 @@ static int write_one_header (FILE *fp, int pfxw, int max, int wraplen,
     {
       tagbuf = mutt_substrdup (start, t);
       ++t; /* skip over the colon separating the header field name and value */
-      SKIPWS(t); /* skip over any leading whitespace */
+
+      /* skip over any leading whitespace (WSP, as defined in RFC5322) */
+      while (*t == ' ' || *t == '\t')
+       t++;
+
       valbuf = mutt_substrdup (t, end);
     }
     dprint(4,(debugfile,"mwoh: buf[%s%s] too long, "