From: Thomas Roessler Date: Thu, 30 May 2002 12:15:02 +0000 (+0000) Subject: Properly handle empty addresses (<>) when they show up in mail X-Git-Tag: mutt-1-5-2-rel~85 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a7e19b306abd48b460c756b79b0b801fba011193;p=mutt Properly handle empty addresses (<>) when they show up in mail headers. The approach taken is to store this address as <@>, and to check this special case when printing an address. --- diff --git a/rfc822.c b/rfc822.c index 7f554f53..78552da7 100644 --- a/rfc822.c +++ b/rfc822.c @@ -280,12 +280,15 @@ parse_route_addr (const char *s, if ((s = parse_address (s, token, &tokenlen, sizeof (token) - 1, comment, commentlen, commentmax, addr)) == NULL) return NULL; - if (*s != '>' || !addr->mailbox) + if (*s != '>') { RFC822Error = ERR_BAD_ROUTE_ADDR; return NULL; } + if (!addr->mailbox) + addr->mailbox = safe_strdup ("@"); + s++; return s; } @@ -621,8 +624,16 @@ void rfc822_write_address_single (char *buf, size_t buflen, ADDRESS *addr) { if (!buflen) goto done; - strfcpy (pbuf, addr->mailbox, buflen); - len = mutt_strlen (pbuf); + if (ascii_strcmp (addr->mailbox, "@")) + { + strfcpy (pbuf, addr->mailbox, buflen); + len = mutt_strlen (pbuf); + } + else + { + *pbuf = '\0'; + len = 0; + } pbuf += len; buflen -= len;