aboutsummaryrefslogtreecommitdiff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-02-19 12:01:16 +0000
committerPeter Stephenson <pws@zsh.org>2015-02-19 12:01:16 +0000
commit2cbf9d7e65b2f5aeb51c165cdf9033938cba50e6 (patch)
tree5f96169eb2eb7b1f0ac8bb81b1c24d92236b9531 /Src
parent52e938bac954d6d503e180287bcf657187ef8803 (diff)
downloadzsh-2cbf9d7e65b2f5aeb51c165cdf9033938cba50e6.tar.gz
zsh-2cbf9d7e65b2f5aeb51c165cdf9033938cba50e6.tar.xz
zsh-2cbf9d7e65b2f5aeb51c165cdf9033938cba50e6.zip
34573: Safer failure to handle command substitution
Diffstat (limited to 'Src')
-rw-r--r--Src/subst.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/Src/subst.c b/Src/subst.c
index 056b12b27..176a004ac 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -264,7 +264,7 @@ stringsubst(LinkList list, LinkNode node, int pf_flags, int asssub)
while (*str != Outparmath && *str)
str++;
if (*str != Outparmath) {
- zerr("Failed to find end of math substitution");
+ zerr("failed to find end of math substitution");
return NULL;
}
str[-1] = '\0';
@@ -278,8 +278,12 @@ stringsubst(LinkList list, LinkNode node, int pf_flags, int asssub)
endchar = c;
*str = '\0';
- while (*++str != endchar)
- DPUTS(!*str, "BUG: parse error in command substitution");
+ while (*++str != endchar) {
+ if (!*str) {
+ zerr("failed to find end of command substitution");
+ return NULL;
+ }
+ }
}
*str++ = '\0';