[exim-cvs] Fix listquote expansion item to handle empty-stri…

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Exim Git Commits Mailing List
Datum:  
To: exim-cvs
Betreff: [exim-cvs] Fix listquote expansion item to handle empty-string input
Gitweb: https://git.exim.org/exim.git/commitdiff/43ac2ce5e55c134367e7a6c8eb8d2129df00c770
Commit:     43ac2ce5e55c134367e7a6c8eb8d2129df00c770
Parent:     c21235119a8ab47a55abcf94a83aace510edf5d7
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Mon May 25 11:38:25 2020 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Mon May 25 21:05:55 2020 +0100


    Fix listquote expansion item to handle empty-string input
---
 src/src/expand.c             | 3 ++-
 test/scripts/0000-Basic/0002 | 1 +
 test/stdout/0002             | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)


diff --git a/src/src/expand.c b/src/src/expand.c
index 7c9d481..2c29c26 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 db8d709..a8fc0bc 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 ea918ae..b8ff361 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