diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2020-02-17 10:15:35 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-02-17 10:15:35 +0100 |
commit | c2ce888030b6b880b3229520a8ff7d7026248a9a (patch) | |
tree | 2b9d9032ff83d7a26cd54ea8c4f1c098f6ed3626 /shell | |
parent | 3f4847b6d9198a359e98933271af4630b3c41f0a (diff) | |
download | busybox-w32-c2ce888030b6b880b3229520a8ff7d7026248a9a.tar.gz busybox-w32-c2ce888030b6b880b3229520a8ff7d7026248a9a.tar.bz2 busybox-w32-c2ce888030b6b880b3229520a8ff7d7026248a9a.zip |
ash: parser: Only accept single-digit parameter expansion outside of braces
Upstream commit:
Date: Mon, 27 May 2019 13:39:37 +0800
parser: Only accept single-digit parameter expansion outside of braces
This patch should fix the problem.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 2 | ||||
-rw-r--r-- | shell/ash_test/ash-vars/var_10.right | 3 | ||||
-rwxr-xr-x | shell/ash_test/ash-vars/var_10.tests | 4 | ||||
-rw-r--r-- | shell/hush_test/hush-vars/var_10.right | 3 | ||||
-rwxr-xr-x | shell/hush_test/hush-vars/var_10.tests | 4 |
5 files changed, 15 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c index a25d14de0..90496ba7e 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -12602,7 +12602,7 @@ parsesub: { | |||
12602 | do { | 12602 | do { |
12603 | STPUTC(c, out); | 12603 | STPUTC(c, out); |
12604 | c = pgetc_eatbnl(); | 12604 | c = pgetc_eatbnl(); |
12605 | } while (isdigit(c)); | 12605 | } while (!subtype && isdigit(c)); |
12606 | } else if (c != '}') { | 12606 | } else if (c != '}') { |
12607 | /* $[{[#]]<specialchar>[}] */ | 12607 | /* $[{[#]]<specialchar>[}] */ |
12608 | int cc = c; | 12608 | int cc = c; |
diff --git a/shell/ash_test/ash-vars/var_10.right b/shell/ash_test/ash-vars/var_10.right new file mode 100644 index 000000000..675ab45f6 --- /dev/null +++ b/shell/ash_test/ash-vars/var_10.right | |||
@@ -0,0 +1,3 @@ | |||
1 | Zero:0 | ||
2 | One:1 | ||
3 | Done:0 | ||
diff --git a/shell/ash_test/ash-vars/var_10.tests b/shell/ash_test/ash-vars/var_10.tests new file mode 100755 index 000000000..7364efb55 --- /dev/null +++ b/shell/ash_test/ash-vars/var_10.tests | |||
@@ -0,0 +1,4 @@ | |||
1 | set -- : 2 3 4 5 6 7 8 9 ten eleven | ||
2 | echo Zero$10 | ||
3 | echo One$11 | ||
4 | echo Done:$? | ||
diff --git a/shell/hush_test/hush-vars/var_10.right b/shell/hush_test/hush-vars/var_10.right new file mode 100644 index 000000000..675ab45f6 --- /dev/null +++ b/shell/hush_test/hush-vars/var_10.right | |||
@@ -0,0 +1,3 @@ | |||
1 | Zero:0 | ||
2 | One:1 | ||
3 | Done:0 | ||
diff --git a/shell/hush_test/hush-vars/var_10.tests b/shell/hush_test/hush-vars/var_10.tests new file mode 100755 index 000000000..7364efb55 --- /dev/null +++ b/shell/hush_test/hush-vars/var_10.tests | |||
@@ -0,0 +1,4 @@ | |||
1 | set -- : 2 3 4 5 6 7 8 9 ten eleven | ||
2 | echo Zero$10 | ||
3 | echo One$11 | ||
4 | echo Done:$? | ||