From: Michael Elkins Date: Tue, 18 Dec 2012 10:21:57 +0000 (-0800) Subject: fix problem where mutt_substrdup() was called with the start X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b6e832c012c66b22e8c63e3c1347a733def94960;p=neomutt fix problem where mutt_substrdup() was called with the start 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 --- diff --git a/sendlib.c b/sendlib.c index 249d6a1d1..44382602f 100644 --- 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, "