1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-03 08:11:03 +02:00

49957: Brown paper bag for 49915

The code would crash when n == 0. There's not really any point doing any
of this when n is 0 so just skip everything. It also tried to NULL
terminate a list a little to eagerly.
This commit is contained in:
Mikael Magnusson 2022-04-03 01:08:51 +02:00
parent 92f193f7de
commit 9eda397354
2 changed files with 4 additions and 2 deletions

View file

@ -3,6 +3,8 @@
* 49959: Completion/Zsh/Context/_brace_parameter:
_brace_parameter: add (-)
* 49957: Src/Zle/compcore.c: Brown paper bag for 49915
2022-04-02 dana <dana@dana.is>
* unposted (see 48073): Completion/Zsh/Command/_fc: Complete

View file

@ -3247,7 +3247,7 @@ makearray(LinkList l, int type, int flags, int *np, int *nlp, int *llp)
}
*cp = NULL;
}
} else {
} else if (n > 0) {
if (!(flags & CGF_NOSORT)) {
/* Now sort the array (it contains matches). */
matchorder = flags;
@ -3320,8 +3320,8 @@ makearray(LinkList l, int type, int flags, int *np, int *nlp, int *llp)
}
*ap = *bp;
}
*ap = NULL;
}
*ap = NULL;
/* passed -1 but not -2, so remove consecutive duplicates (efficient) */
} else if (!(flags & CGF_UNIQCON)) {
int dup;