summary refs log tree commit diff
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2013-09-18 23:50:04 +0200
committerPeter Stephenson <pws@zsh.org>2013-09-19 09:45:45 +0100
commit844e569b632fc032576edc039f793be47fde724e (patch)
tree06b65b3960828de9569f7d1460594339fbd59576
parent075ad840d60de2d794aea81f2ba2eb2a5473bca4 (diff)
downloadzsh-844e569b632fc032576edc039f793be47fde724e.tar.gz
zsh-844e569b632fc032576edc039f793be47fde724e.tar.xz
zsh-844e569b632fc032576edc039f793be47fde724e.zip
31735: fix off-by-one in completion utility cache code.
Was causing crashes in complex completions, particularly with taskwarrior
-rw-r--r--ChangeLog6
-rw-r--r--Src/Zle/computil.c2
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 286c4037a..12b5b5b0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-09-19  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* Axel Beckert: 31735: Src/Zle/computil.c (get_cvdef):
+	off-by-one in obscure loop handling could cause crash in complex
+	completion.
+
 2013-09-14  Luka Perkov  <luka@openwrt.org>
 
 	* 31723: Completion/Unix/Command/_systemd: _systemd: add more
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index cd508d0ac..2c323eefe 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -2992,7 +2992,7 @@ get_cvdef(char *nam, char **args)
 	    return *p;
 	} else if (!min || !*p || (*p)->lastt < (*min)->lastt)
 	    min = p;
-    if (i)
+    if (i > 0)
 	min = p;
     if ((new = parse_cvdef(nam, args))) {
 	freecvdef(*min);