770af7351b
Copy from server:mail/mutt based on submit request 25390 from user WernerFink OBS-URL: https://build.opensuse.org/request/show/25390 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/mutt?expand=0&rev=21
63 lines
2.0 KiB
Plaintext
63 lines
2.0 KiB
Plaintext
--- sendlib.c
|
|
+++ sendlib.c 2009-12-02 11:35:43.095929251 +0000
|
|
@@ -1630,9 +1630,9 @@ static int fold_one_header (FILE *fp, co
|
|
dprint(4,(debugfile,"mwoh: pfx=[%s], tag=[%s], flags=%d value=[%s]\n",
|
|
pfx, tag, flags, value));
|
|
|
|
- if (fprintf (fp, "%s%s: ", NONULL (pfx), tag) < 0)
|
|
+ if (tag && *tag && fprintf (fp, "%s%s: ", NONULL (pfx), tag) < 0)
|
|
return -1;
|
|
- col = mutt_strlen (tag) + 2 + mutt_strlen (pfx);
|
|
+ col = mutt_strlen (tag) + (tag && *tag ? 2 : 0) + mutt_strlen (pfx);
|
|
|
|
while (p && *p)
|
|
{
|
|
@@ -1717,9 +1717,11 @@ static int write_one_header (FILE *fp, i
|
|
int flags)
|
|
{
|
|
char *tagbuf, *valbuf, *t;
|
|
+ int is_from = ((end - start) > 5 &&
|
|
+ ascii_strncasecmp (start, "from ", 5) == 0);
|
|
|
|
/* only pass through folding machinery if necessary for sending */
|
|
- if (!(flags & CH_DISPLAY) && pfxw + max <= wraplen)
|
|
+ if (!(flags & CH_DISPLAY) && (pfxw + max <= wraplen || is_from))
|
|
{
|
|
valbuf = mutt_substrdup (start, end);
|
|
dprint(4,(debugfile,"mwoh: buf[%s%s] short enough, "
|
|
@@ -1728,6 +1730,8 @@ static int write_one_header (FILE *fp, i
|
|
if (pfx && *pfx)
|
|
if (fputs (pfx, fp) == EOF)
|
|
return -1;
|
|
+ if (!(t = strchr (valbuf, ':')))
|
|
+ return 0;
|
|
if (print_val (fp, pfx, valbuf, flags) < 0)
|
|
{
|
|
FREE(&valbuf);
|
|
@@ -1738,10 +1742,22 @@ static int write_one_header (FILE *fp, i
|
|
else
|
|
{
|
|
t = strchr (start, ':');
|
|
- tagbuf = mutt_substrdup (start, t);
|
|
- valbuf = mutt_substrdup (t + 2, end);
|
|
+ if (t > end)
|
|
+ {
|
|
+ return 0;
|
|
+ }
|
|
+ if (is_from)
|
|
+ {
|
|
+ tagbuf = NULL;
|
|
+ valbuf = mutt_substrdup (start, end);
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ tagbuf = mutt_substrdup (start, t);
|
|
+ valbuf = mutt_substrdup (t + 2, end);
|
|
+ }
|
|
dprint(4,(debugfile,"mwoh: buf[%s%s] too long, "
|
|
- "max width = %d > %dn",
|
|
+ "max width = %d > %d\n",
|
|
NONULL(pfx), valbuf, max, wraplen));
|
|
if (fold_one_header (fp, tagbuf, valbuf, pfx, wraplen, flags) < 0)
|
|
return -1;
|