summaryrefslogtreecommitdiffhomepage
path: root/shell
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-06-25 02:08:38 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2021-06-25 02:08:38 +0200
commitad57e4e4b23926002ce72979729b017520bef1d0 (patch)
tree50d55a641789e22f875b520741bfb7dc64395e60 /shell
parent53e5c598217db8b6a4e3cddefa260dd5cf0863ea (diff)
ash: revert accidental change (should have been separate)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 2eac6e113..bee81920a 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -12751,7 +12751,7 @@ parsesub: {
do {
STPUTC(c, out);
c = pgetc_eatbnl();
- } while ((subtype == 0 || subtype == VSLENGTH) && isdigit(c));
+ } while (!subtype && isdigit(c));
} else if (c != '}') {
/* $[{[#]]<specialchar>[}] */
int cc = c;
@@ -12781,6 +12781,11 @@ parsesub: {
} else
goto badsub;
+ if (c != '}' && subtype == VSLENGTH) {
+ /* ${#VAR didn't end with } */
+ goto badsub;
+ }
+
if (subtype == 0) {
static const char types[] ALIGN1 = "}-+?=";
/* ${VAR...} but not $VAR or ${#VAR} */
@@ -12837,8 +12842,6 @@ parsesub: {
#endif
}
} else {
- if (subtype == VSLENGTH && c != '}')
- subtype = 0;
badsub:
pungetc();
}