[git commit] ash: parser: Only accept single-digit parameter expansion outside of braces

Denys Vlasenko vda.linux at googlemail.com
Mon Feb 17 09:15:35 UTC 2020


commit: https://git.busybox.net/busybox/commit/?id=c2ce888030b6b880b3229520a8ff7d7026248a9a
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

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 at gondor.apana.org.au>

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 shell/ash.c                            | 2 +-
 shell/ash_test/ash-vars/var_10.right   | 3 +++
 shell/ash_test/ash-vars/var_10.tests   | 4 ++++
 shell/hush_test/hush-vars/var_10.right | 3 +++
 shell/hush_test/hush-vars/var_10.tests | 4 ++++
 5 files changed, 15 insertions(+), 1 deletion(-)

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: {
 			do {
 				STPUTC(c, out);
 				c = pgetc_eatbnl();
-			} while (isdigit(c));
+			} while (!subtype && isdigit(c));
 		} else if (c != '}') {
 			/* $[{[#]]<specialchar>[}] */
 			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 @@
+Zero:0
+One:1
+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 @@
+set -- : 2 3 4 5 6 7 8 9 ten eleven
+echo Zero$10
+echo One$11
+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 @@
+Zero:0
+One:1
+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 @@
+set -- : 2 3 4 5 6 7 8 9 ten eleven
+echo Zero$10
+echo One$11
+echo Done:$?


More information about the busybox-cvs mailing list