diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2005-03-11 10:33:39 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2005-03-11 10:33:39 +0000 |
commit | 15b78be794713c7bb2c5c6c93b9011ca41b82d1d (patch) | |
tree | 2a6a20186d81e894d07cdfd4a48bcde8e62c9ff7 | |
parent | 6ab396f5fb902cede91ba23e2108f79efb0c7a3b (diff) | |
download | zsh-15b78be794713c7bb2c5c6c93b9011ca41b82d1d.tar.gz zsh-15b78be794713c7bb2c5c6c93b9011ca41b82d1d.tar.xz zsh-15b78be794713c7bb2c5c6c93b9011ca41b82d1d.zip |
20966: fix crash in execute-named-command
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Src/Zle/zle_misc.c | 10 |
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), - <mp, NULL); + char *peekstr = ztrdup(peekfirst(namedcmdll)); + ZLE_STRING_T ztmp = stringaszleline(peekstr, <mp, NULL); + zsfree(peekstr); ZS_memcpy(cmdbuf, ztmp, ltmp); free(ztmp); ptr = cmdbuf + namedcmdambig; |