diff mbox series

expand: Eat closing brace for length parameter expansion

Message ID 20181119104120.r2rx3vapaoh3ilvk@gondor.apana.org.au (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series expand: Eat closing brace for length parameter expansion | expand

Commit Message

Herbert Xu Nov. 19, 2018, 10:41 a.m. UTC
Apologies for the reposts, but I'm having problems making this
get into patchwork.
 
---8<---
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@inlv.org>
Fixes: 3cd538634f71 ("expand: Do not reprocess data when...")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
diff mbox series

Patch

diff --git a/src/expand.c b/src/expand.c
index 856b7a9..af9cac9 100644
--- a/src/expand.c
+++ b/src/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);