[PATCH v2 2/7] lib-mail: message_address_write: Fix generating group list with empty name
Pali Rohár
pali.rohar at gmail.com
Sun Jun 5 13:48:15 UTC 2016
Empty name for group list must be quoted.
Test case:
{ { name = NULL, mailbox = "", domain = NULL }, { name = NULL, mailbox = NULL, domain = NULL } }
converts to:
"":;
---
src/lib-mail/message-address.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/lib-mail/message-address.c b/src/lib-mail/message-address.c
index efa91fd..9ce4a55 100644
--- a/src/lib-mail/message-address.c
+++ b/src/lib-mail/message-address.c
@@ -357,8 +357,12 @@ void message_address_write(string_t *str, const struct message_address *addr)
if (!in_group) {
/* beginning of group. mailbox is the group
name, others are NULL. */
- if (addr->mailbox != NULL)
+ if (addr->mailbox != NULL && *addr->mailbox != '\0') {
str_append(str, addr->mailbox);
+ } else {
+ /* empty group name needs to be quoted */
+ str_append(str, "\"\"");
+ }
str_append(str, ": ");
first = TRUE;
} else {
--
1.7.9.5
More information about the dovecot
mailing list