about summary refs log tree commit diff
path: root/Src/subst.c
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2015-01-18 22:38:57 +0000
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2015-01-18 22:38:57 +0000
commitc6c9f5daf2e196e6ab7346dfbf5f5166a1d87f0c (patch)
treede064fa6ba629549d42868b7016dd3c28bfb0e34 /Src/subst.c
parent6856ab39e32e0cba96fcdae004878938125890ac (diff)
downloadzsh-c6c9f5daf2e196e6ab7346dfbf5f5166a1d87f0c.tar.gz
zsh-c6c9f5daf2e196e6ab7346dfbf5f5166a1d87f0c.tar.xz
zsh-c6c9f5daf2e196e6ab7346dfbf5f5166a1d87f0c.zip
34322: bug with interface to parsestr() etc.
Was showing up in places like ${(e)...} where command substitution
could reallocate the token string, but actually there was never any
guarantee that the lexer wouldn't do that, so this was always
a bit iffy.
Diffstat (limited to 'Src/subst.c')
-rw-r--r--Src/subst.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Src/subst.c b/Src/subst.c
index 5f993d6fd..a2bb6483a 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -1306,7 +1306,7 @@ get_intarg(char **s, int *delmatchp)
     p = dupstring(*s + arglen);
     *s = t + arglen;
     *t = sav;
-    if (parsestr(p))
+    if (parsestr(&p))
 	return -1;
     singsub(&p);
     if (errflag)
@@ -1329,7 +1329,8 @@ subst_parse_str(char **sp, int single, int err)
 
     *sp = s = dupstring(*sp);
 
-    if (!(err ? parsestr(s) : parsestrnoerr(s))) {
+    if (!(err ? parsestr(&s) : parsestrnoerr(&s))) {
+	*sp = s;
 	if (!single) {
             int qt = 0;
 
@@ -1439,7 +1440,8 @@ check_colon_subscript(char *str, char **endp)
     }
     sav = **endp;
     **endp = '\0';
-    if (parsestr(str = dupstring(str)))
+    str = dupstring(str);
+    if (parsestr(&str))
 	return NULL;
     singsub(&str);
     remnulargs(str);