@@ -1,3 +1,7 @@
+2014-10-30 Herbert Xu <herbert@gondor.apana.org.au>
+
+ * Catch variable length expansions on non-existant specials.
+
2014-10-28 Herbert Xu <herbert@gondor.apana.org.au>
* Removed unnecessary pungetc on EOF from parser.
@@ -1229,8 +1229,7 @@ varname:
STPUTC(c, out);
c = pgetc_eatbnl();
} while (is_digit(c));
- }
- else if (is_special(c)) {
+ } else {
int cc = c;
c = pgetc_eatbnl();
@@ -1251,10 +1250,14 @@ varname:
}
}
+ if (!is_special(cc)) {
+ if (subtype == VSLENGTH)
+ subtype = 0;
+ goto badsub;
+ }
+
USTPUTC(cc, out);
}
- else
- goto badsub;
if (subtype == 0) {
switch (c) {
Currently we only check special variable names that follow directly after $ or ${. So errors such as ${#&} are not caught. This patch fixes that by moving the is_special check to just before we print out the special variable name. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> --- ChangeLog | 4 ++++ src/parser.c | 11 +++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe dash" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html