From a7e19b306abd48b460c756b79b0b801fba011193 Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Thu, 30 May 2002 12:15:02 +0000 Subject: [PATCH] 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. --- rfc822.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) 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; -- 2.40.0