ash: parser: Fix VSLENGTH parsing with trailing garbage
Let's adopt Herbert Xu's patch, not waiting for it to reach dash git: hush already has a similar fix. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
ad57e4e4b2
commit
53a7a9cd8c
@ -12751,7 +12751,7 @@ parsesub: {
|
|||||||
do {
|
do {
|
||||||
STPUTC(c, out);
|
STPUTC(c, out);
|
||||||
c = pgetc_eatbnl();
|
c = pgetc_eatbnl();
|
||||||
} while (!subtype && isdigit(c));
|
} while ((subtype == 0 || subtype == VSLENGTH) && isdigit(c));
|
||||||
} else if (c != '}') {
|
} else if (c != '}') {
|
||||||
/* $[{[#]]<specialchar>[}] */
|
/* $[{[#]]<specialchar>[}] */
|
||||||
int cc = c;
|
int cc = c;
|
||||||
@ -12781,11 +12781,6 @@ parsesub: {
|
|||||||
} else
|
} else
|
||||||
goto badsub;
|
goto badsub;
|
||||||
|
|
||||||
if (c != '}' && subtype == VSLENGTH) {
|
|
||||||
/* ${#VAR didn't end with } */
|
|
||||||
goto badsub;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (subtype == 0) {
|
if (subtype == 0) {
|
||||||
static const char types[] ALIGN1 = "}-+?=";
|
static const char types[] ALIGN1 = "}-+?=";
|
||||||
/* ${VAR...} but not $VAR or ${#VAR} */
|
/* ${VAR...} but not $VAR or ${#VAR} */
|
||||||
@ -12842,6 +12837,8 @@ parsesub: {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (subtype == VSLENGTH && c != '}')
|
||||||
|
subtype = 0;
|
||||||
badsub:
|
badsub:
|
||||||
pungetc();
|
pungetc();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user