summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJasen Betts <jasen@xnet.co.nz>2019-02-18 13:52:16 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2019-02-18 13:57:17 +0000
commite2ff8e24f41caca3623228b1ec66a3f3961ecad6 (patch)
treebdb30086fa19c65b797223d5949557e1c1c1af21 /src
parentfc243e944ec00b59b75f41d07494116f925d58b4 (diff)
Fix expansions for RFC 822 addresses having comments in local-part and/or domain. Bug 2375
Diffstat (limited to 'src')
-rw-r--r--src/src/expand.c19
1 files changed, 7 insertions, 12 deletions
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);