X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/1ad6489edabbfce85ee7362370cee4b34739c234..2ad7897851d62bc690844f416d4ca2fabedf9459:/src/src/readconf.c diff --git a/src/src/readconf.c b/src/src/readconf.c index 60df37afc..31a4f2da4 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -1597,18 +1597,16 @@ switch (type) } else if (ol->type & opt_rep_str) { - uschar sep = Ustrncmp(name, "headers_add", 11)==0 ? '\n' : ':'; - uschar * cp; - - /* Strip trailing whitespace and seperators */ - for (cp = sptr + Ustrlen(sptr) - 1; - cp >= sptr && (*cp == '\n' || *cp == '\t' || *cp == ' ' || *cp == sep); - cp--) *cp = '\0'; - - if (cp >= sptr) - *str_target = string_copy_malloc( - *str_target ? string_sprintf("%s%c%s", *str_target, sep, sptr) - : sptr); + uschar sep_o = Ustrncmp(name, "headers_add", 11)==0 ? '\n' : ':'; + int sep_i = -(int)sep_o; + uschar * list = sptr; + uschar * s; + uschar * list_o = *str_target; + + while ((s = string_nextinlist(&list, &sep_i, NULL, 0))) + list_o = string_append_listele(list_o, sep_o, s); + if (list_o) + *str_target = string_copy_malloc(list_o); } else {