diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2018-11-19 18:00:32 +0800 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2020-03-28 21:42:55 +0000 |
commit | 60413cc28c9b0b423e89fefff476d39c1926d6da (patch) | |
tree | 805083fa6714fbc7c9041d0ae7a5f7c809f5d422 | |
parent | e3da328217a1fbfaad2ae617dbc26746adf63f8f (diff) | |
download | klibc-60413cc28c9b0b423e89fefff476d39c1926d6da.tar.gz |
[klibc] dash: eval: Use the correct expansion mode for fd redirection
[ dash commit 70712c93c40a322056dafce7cbb45c727400936b ]
It has been reported that
echo test >&$EMPTY_VARIABLE
causes dash to segfault. This is a symptom of the bigger problem
that dash tries to perform pathname expansion as well as field
splitting on the word after >& and <&. This is wrong and this
patch fixes it to use the same expansions as done on a normal
redirection.
Reported-by: Andrej Shadura <andrew.shadura@collabora.co.uk>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | usr/dash/eval.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/usr/dash/eval.c b/usr/dash/eval.c index dc0c9fa20500c..4981f15613f75 100644 --- a/usr/dash/eval.c +++ b/usr/dash/eval.c @@ -529,7 +529,7 @@ expredir(union node *n) case NFROMFD: case NTOFD: if (redir->ndup.vname) { - expandarg(redir->ndup.vname, &fn, EXP_FULL | EXP_TILDE); + expandarg(redir->ndup.vname, &fn, EXP_TILDE | EXP_REDIR); fixredir(redir, fn.list->text, 1); } break; |