mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-12-29 19:12:20 +01:00
34573: Safer failure to handle command substitution
This commit is contained in:
parent
52e938bac9
commit
2cbf9d7e65
2 changed files with 10 additions and 3 deletions
|
|
@ -1,5 +1,8 @@
|
|||
2015-02-19 Peter Stephenson <p.stephenson@samsung.com>
|
||||
|
||||
* 34573: Src/subst.c: safer handling of failure to perform
|
||||
command substitution.
|
||||
|
||||
* 34570: Config/version.mk, Src/lex.c, Src/subst.c, Src/zsh.h,
|
||||
Test/C01arith.ztst: mark arithmetic substitutions with tokens
|
||||
so the substitution code knows what to do.
|
||||
|
|
|
|||
10
Src/subst.c
10
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';
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue