about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-03-11 10:33:39 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-03-11 10:33:39 +0000
commit15b78be794713c7bb2c5c6c93b9011ca41b82d1d (patch)
tree2a6a20186d81e894d07cdfd4a48bcde8e62c9ff7
parent6ab396f5fb902cede91ba23e2108f79efb0c7a3b (diff)
downloadzsh-15b78be794713c7bb2c5c6c93b9011ca41b82d1d.tar.gz
zsh-15b78be794713c7bb2c5c6c93b9011ca41b82d1d.tar.xz
zsh-15b78be794713c7bb2c5c6c93b9011ca41b82d1d.zip
20966: fix crash in execute-named-command
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/zle_misc.c10
2 files changed, 11 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index ad4e75b35..69f9ebadc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-03-11  Peter Stephenson  <pws@csr.com>
+
+	* 20966: Src/Zle/zle_misc.c: need to copy strings to avoid
+	crash in completion for execute-named-command.
+
 2005-03-09  Clint Adams  <clint@zsh.org>
 
 	* 20961: Completion/Unix/Command/_baz: fix completion of status and
diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c
index b2c101b3a..022d98e64 100644
--- a/Src/Zle/zle_misc.c
+++ b/Src/Zle/zle_misc.c
@@ -911,8 +911,9 @@ executenamedcommand(char *prmt)
 		    showinglist = 0;
 		    zmult = zmultsav;
 		} else if (!nextnode(firstnode(namedcmdll))) {
-		    ZLE_STRING_T ztmp = stringaszleline(peekfirst(namedcmdll),
-							&len, NULL);
+		    char *peekstr = ztrdup(peekfirst(namedcmdll));
+		    ZLE_STRING_T ztmp = stringaszleline(peekstr, &len, NULL);
+		    zsfree(peekstr);
 		    ZS_memcpy(ptr = cmdbuf, ztmp, len);
 		    ptr += len;
 		    free(ztmp);
@@ -920,8 +921,9 @@ executenamedcommand(char *prmt)
 			goto unambiguous;
 		} else {
 		    int ltmp;
-		    ZLE_STRING_T ztmp = stringaszleline(peekfirst(namedcmdll),
-							&ltmp, NULL);
+		    char *peekstr = ztrdup(peekfirst(namedcmdll));
+		    ZLE_STRING_T ztmp = stringaszleline(peekstr, &ltmp, NULL);
+		    zsfree(peekstr);
 		    ZS_memcpy(cmdbuf, ztmp, ltmp);
 		    free(ztmp);
 		    ptr = cmdbuf + namedcmdambig;