Fix listquote expansion item to handle empty-string input
[exim.git] / src / src / expand.c
index 7c9d481000223e2fcd33cff2e24f79f8525a565b..2c29c26d538550801ae7574e597b588860e17fd0 100644 (file)
@@ -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;
       }