From: Jeremy Harris Date: Mon, 25 May 2020 10:38:25 +0000 (+0100) Subject: Fix listquote expansion item to handle empty-string input X-Git-Tag: exim-4.94~4 X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/43ac2ce5e55c134367e7a6c8eb8d2129df00c770?hp=c21235119a8ab47a55abcf94a83aace510edf5d7 Fix listquote expansion item to handle empty-string input --- diff --git a/src/src/expand.c b/src/src/expand.c index 7c9d48100..2c29c26d5 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -6186,11 +6186,12 @@ while (*s != 0) case 2: case 3: goto EXPAND_FAILED; } - for (uschar sep = *sub[0], c; c = *sub[1]; sub[1]++) + if (*sub[1]) for (uschar sep = *sub[0], c; c = *sub[1]; sub[1]++) { if (c == sep) yield = string_catn(yield, sub[1], 1); yield = string_catn(yield, sub[1], 1); } + else yield = string_catn(yield, US" ", 1); continue; } diff --git a/test/scripts/0000-Basic/0002 b/test/scripts/0000-Basic/0002 index db8d70981..a8fc0bcb2 100644 --- a/test/scripts/0000-Basic/0002 +++ b/test/scripts/0000-Basic/0002 @@ -133,6 +133,7 @@ listquote: ${listquote{:}{ab::cd}} listquote: ${listquote{;}{ab:cd}} listquote: ${listquote{;}{ab;cd}} listquote: ${listquote{ }{ ab cd}} +listquote: <${listquote{:}{}}> sort: ${sort{3:2:1:4}{<}{$item}} sort: ${sort {<, 3,2,1,4}{>}{$item}} diff --git a/test/stdout/0002 b/test/stdout/0002 index ea918aebb..b8ff36122 100644 --- a/test/stdout/0002 +++ b/test/stdout/0002 @@ -122,6 +122,7 @@ > listquote: ab:cd > listquote: ab;;cd > listquote: ab cd +> listquote: < > > > sort: 1:2:3:4 > sort: 4,3,2,1