1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-23 04:30:24 +02:00

users/17046: don't count too many elements when splitting quoted parameter

substitution on null parameter
This commit is contained in:
Peter Stephenson 2012-05-01 19:43:44 +00:00
parent 8da652f6ae
commit cd1b5d86e0
3 changed files with 23 additions and 3 deletions

View file

@ -3114,7 +3114,7 @@ wordcount(char *s, char *sep, int mul)
r = 1;
sl = strlen(sep);
for (; (c = findsep(&s, sep, 0)) >= 0; s += sl)
if ((c && *(s + sl)) || mul)
if ((c || mul) && (sl || *(s + sl)))
r++;
} else {
char *t = s;