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.shad...@collabora.co.uk>
Signed-off-by: Herbert Xu <herb...@gondor.apana.org.au>

diff --git a/src/eval.c b/src/eval.c
index 6185db4..328fde3 100644
--- a/src/eval.c
+++ b/src/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;
-- 
Email: Herbert Xu <herb...@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Reply via email to