summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2022-04-03 01:08:51 +0200
committerMikael Magnusson <mikachu@gmail.com>2022-04-03 11:28:14 +0200
commit9eda39735430549f2beebc94282fee90b4fb552c (patch)
tree714738e1614f72da7543485296a557a9d3843bdb
parent92f193f7dea9cb4883197a96aee2bab7ffdf72af (diff)
downloadzsh-9eda39735430549f2beebc94282fee90b4fb552c.tar.gz
zsh-9eda39735430549f2beebc94282fee90b4fb552c.zip
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.
-rw-r--r--ChangeLog2
-rw-r--r--Src/Zle/compcore.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index f7766aefa..3b0edff7a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index 18b8cb531..fe3ea10fc 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -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;