diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2009-03-03 22:11:37 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2009-03-03 22:11:37 +0000 |
commit | d60f73f7081a327fc6d6b9f988c763ab7b228f74 (patch) | |
tree | 3f5abcbd88b93a5f9b87867cb071f087b3516ec2 /Src | |
parent | a3e73c8d05526b8c9d0735cfe747411567784a83 (diff) | |
download | zsh-d60f73f7081a327fc6d6b9f988c763ab7b228f74.tar.gz zsh-d60f73f7081a327fc6d6b9f988c763ab7b228f74.tar.xz zsh-d60f73f7081a327fc6d6b9f988c763ab7b228f74.zip |
26686: problem storing long $_ using VARARR()
Diffstat (limited to 'Src')
-rw-r--r-- | Src/exec.c | 18 | ||||
-rw-r--r-- | Src/utils.c | 13 |
2 files changed, 23 insertions, 8 deletions
diff --git a/Src/exec.c b/Src/exec.c index b86e5350c..ed7c08759 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -4431,10 +4431,12 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval) mod_export void runshfunc(Eprog prog, FuncWrap wrap, char *name) { - int cont; - VARARR(char, ou, underscoreused); + int cont, ouu; + char *ou; - memcpy(ou, underscore, underscoreused); + ou = zalloc(ouu = underscoreused); + if (ou) + memcpy(ou, underscore, underscoreused); while (wrap) { wrap->module->wrapper++; @@ -4445,13 +4447,19 @@ runshfunc(Eprog prog, FuncWrap wrap, char *name) (wrap->module->node.flags & MOD_UNLOAD)) unload_module(wrap->module); - if (!cont) + if (!cont) { + if (ou) + zfree(ou, ouu); return; + } wrap = wrap->next; } startparamscope(); execode(prog, 1, 0); - setunderscore(ou); + if (ou) { + setunderscore(ou); + zfree(ou, ouu); + } endparamscope(); } diff --git a/Src/utils.c b/Src/utils.c index fbe1eb223..7a983d48d 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -1340,9 +1340,13 @@ checkmailpath(char **s) fprintf(shout, "You have new mail.\n"); fflush(shout); } else { - VARARR(char, usav, underscoreused); + char *usav; + int uusav = underscoreused; - memcpy(usav, underscore, underscoreused); + usav = zalloc(underscoreused); + + if (usav) + memcpy(usav, underscore, underscoreused); setunderscore(*s); @@ -1353,7 +1357,10 @@ checkmailpath(char **s) fputc('\n', shout); fflush(shout); } - setunderscore(usav); + if (usav) { + setunderscore(usav); + zfree(usav, uusav); + } } } if (isset(MAILWARNING) && st.st_atime > st.st_mtime && |