about summary refs log tree commit diff
diff options
context:
space:
mode:
-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;