From 7efcad5f3e5d47a67cb1dfbe14936b612fe5bd8e Mon Sep 17 00:00:00 2001 From: Harald van Dijk Date: Thu, 27 Jun 2019 20:52:32 +0100 Subject: [PATCH] Improve parsing of invalid substitutions. Do not skip over invalid characters. Even if we know the substitution is invalid either way, the invalid character may affect how the rest of the substitution is parsed. Test case: : || : ${$""} --- src/parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser.c b/src/parser.c index cd92951..555c5e7 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1445,7 +1445,7 @@ readtoken1_parsesub(char *out, int c, char *eofmark, int flags) default: p = strchr(types, c); if (p == NULL) - break; + goto badsub; subtype |= p - types + VSNORMAL; break; case '%':