X-Git-Url: https://git.llucax.com/software/mutt-debian.git/blobdiff_plain/19304f7c526fbe36ba0db2fb80bcaf3bd974d81d..d6c10f3f616706c8369259369fba5915f17e672a:/copy.c diff --git a/copy.c b/copy.c index fa28320..9ddf411 100644 --- a/copy.c +++ b/copy.c @@ -287,7 +287,7 @@ mutt_copy_hdr (FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end, int flags, if (flags & (CH_DECODE|CH_PREFIX)) { if (mutt_write_one_header (out, 0, headers[x], - flags & CH_PREFIX ? prefix : 0, mutt_term_width (Wrap)) == -1) + flags & CH_PREFIX ? prefix : 0, mutt_term_width (Wrap), flags) == -1) { error = TRUE; break; @@ -633,12 +633,12 @@ _mutt_copy_message (FILE *fpout, FILE *fpin, HEADER *hdr, BODY *body, fseeko (fp, cur->offset, 0); if (mutt_copy_bytes (fp, fpout, cur->length) == -1) { - fclose (fp); + safe_fclose (&fp); mutt_free_body (&cur); return (-1); } mutt_free_body (&cur); - fclose (fp); + safe_fclose (&fp); } else { @@ -865,7 +865,7 @@ static void format_address_header (char **h, ADDRESS *a) static int address_header_decode (char **h) { char *s = *h; - int l; + int l, rp = 0; ADDRESS *a = NULL; @@ -876,6 +876,7 @@ static int address_header_decode (char **h) if (ascii_strncasecmp (s, "return-path:", 12) == 0) { l = 12; + rp = 1; break; } else if (ascii_strncasecmp (s, "reply-to:", 9) == 0) @@ -936,15 +937,20 @@ static int address_header_decode (char **h) mutt_addrlist_to_local (a); rfc2047_decode_adrlist (a); - - *h = safe_calloc (1, l + 2); - - strfcpy (*h, s, l + 1); - - format_address_header (h, a); + + /* angle brackets for return path are mandated by RfC5322, + * so leave Return-Path as-is */ + if (rp) + *h = safe_strdup (s); + else + { + *h = safe_calloc (1, l + 2); + strfcpy (*h, s, l + 1); + format_address_header (h, a); + } rfc822_free_address (&a); - + FREE (&s); return 1; }