]> granicus.if.org Git - mutt/commitdiff
Properly handle empty addresses (<>) when they show up in mail
authorThomas Roessler <roessler@does-not-exist.org>
Thu, 30 May 2002 12:15:02 +0000 (12:15 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Thu, 30 May 2002 12:15:02 +0000 (12:15 +0000)
headers.  The approach taken is to store this address as <@>, and to
check this special case when printing an address.

rfc822.c

index 7f554f530531ee63f2292123301a52c770153124..78552da7411c4f326a00edb6048c4c7736882f52 100644 (file)
--- 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;