[klibc] [klibc:update-dash] dash: expand: Eat closing brace for length parameter expansion

klibc-bot for Herbert Xu herbert at gondor.apana.org.au
Sat Mar 28 14:49:35 PDT 2020


Commit-ID:  16419c03328ad90171240ed5f6ec0127117d43cd
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=16419c03328ad90171240ed5f6ec0127117d43cd
Author:     Herbert Xu <herbert at gondor.apana.org.au>
AuthorDate: Mon, 19 Nov 2018 18:41:20 +0800
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Sat, 28 Mar 2020 21:42:55 +0000

[klibc] dash: expand: Eat closing brace for length parameter expansion

[ dash commit 878514712c5d21f675c45d99d2f8a04098ea4a19 ]

When we are doing VSLENGTH expansion, the closing brace is currently
not removed in evalvar.  This causes the caller argstr to terminate
prematurely as it would interpret the closing brace as one that
belongs to a parameter expansion at the outer level.

This patch fixes it.

Reported-by: Martijn Dekker <martijn at inlv.org>
Fixes: 3cd538634f71 ("expand: Do not reprocess data when...")
Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>

---
 usr/dash/expand.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/usr/dash/expand.c b/usr/dash/expand.c
index 25236c09..20362cef 100644
--- a/usr/dash/expand.c
+++ b/usr/dash/expand.c
@@ -745,6 +745,7 @@ again:
 		varunset(p, var, 0, 0);
 
 	if (subtype == VSLENGTH) {
+		p++;
 		if (flag & EXP_DISCARD)
 			return p;
 		cvtnum(varlen > 0 ? varlen : 0, flag);


More information about the klibc mailing list