From e2ff8e24f41caca3623228b1ec66a3f3961ecad6 Mon Sep 17 00:00:00 2001 From: Jasen Betts Date: Mon, 18 Feb 2019 13:52:16 +0000 Subject: Fix expansions for RFC 822 addresses having comments in local-part and/or domain. Bug 2375 --- src/src/expand.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/src/expand.c b/src/src/expand.c index e3615cdb0..6e0ba93d6 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -7103,16 +7103,11 @@ while (*s != 0) uschar * t = parse_extract_address(sub, &error, &start, &end, &domain, FALSE); if (t) - if (c != EOP_DOMAIN) - { - if (c == EOP_LOCAL_PART && domain != 0) end = start + domain - 1; - yield = string_catn(yield, sub+start, end-start); - } - else if (domain != 0) - { - domain += start; - yield = string_catn(yield, sub+domain, end-domain); - } + yield = c == EOP_DOMAIN + ? string_cat(yield, t + domain) + : c == EOP_LOCAL_PART && domain > 0 + ? string_catn(yield, t, domain - 1 ) + : string_cat(yield, t); continue; } @@ -7136,7 +7131,7 @@ while (*s != 0) for (;;) { - uschar *p = parse_find_address_end(sub, FALSE); + uschar * p = parse_find_address_end(sub, FALSE); uschar saveend = *p; *p = '\0'; address = parse_extract_address(sub, &error, &start, &end, &domain, @@ -7149,7 +7144,7 @@ while (*s != 0) list, add in a space if the new address begins with the separator character, or is an empty string. */ - if (address != NULL) + if (address) { if (yield->ptr != save_ptr && address[0] == *outsep) yield = string_catn(yield, US" ", 1); -- cgit v1.2.3