X-Git-Url: https://git.llucax.com/software/mutt-debian.git/blobdiff_plain/19304f7c526fbe36ba0db2fb80bcaf3bd974d81d..e0765f8ab8243c097213733be0d4be2a31448b89:/copy.c?ds=sidebyside diff --git a/copy.c b/copy.c index fa28320..62f2727 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,9 +865,10 @@ 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; + ADDRESS *cur = NULL; switch (tolower ((unsigned char) *s)) { @@ -876,6 +877,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 +938,23 @@ 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); + for (cur = a; cur; cur = cur->next) + if (cur->personal) + rfc822_dequote_comment (cur->personal); + + /* 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; }