ash: parser: Fix VSLENGTH parsing with trailing garbage
No binary (build failed)
—
(log yok)
| @@ -12751,7 +12751,7 @@ parsesub: { | |
| do { | |
| STPUTC(c, out); | |
| c = pgetc_eatbnl(); | |
| - | } while (!subtype && isdigit(c)); |
| + | } while ((subtype == 0 || subtype == VSLENGTH) && isdigit(c)); |
| } else if (c != '}') { | |
| /* $[{[#]]<specialchar>[}] */ | |
| int cc = c; | |
| @@ -12781,11 +12781,6 @@ 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} */ | |
| @@ -12842,6 +12837,8 @@ parsesub: { | |
| #endif | |
| } | |
| } else { | |
| + | if (subtype == VSLENGTH && c != '}') |
| + | subtype = 0; |
| badsub: | |
| pungetc(); | |
| } | |