1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-10-02 00:41:44 +02:00

20966: fix crash in execute-named-command

This commit is contained in:
Peter Stephenson 2005-03-11 10:33:39 +00:00
parent 6ab396f5fb
commit 15b78be794
2 changed files with 11 additions and 4 deletions

@ -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

@ -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;