From: Denis Vlasenko Date: Mon, 16 Oct 2006 01:33:16 +0000 (-0000) Subject: ash: fix segfault in ash. X-Git-Tag: 1_4_0~502 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5f03158f66dc2c73b052307f3871c4341fbabb8e;p=oweals%2Fbusybox.git ash: fix segfault in ash. patch by walter harms --- diff --git a/shell/ash.c b/shell/ash.c index 1260d5e9a..a34c871f1 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -3042,6 +3042,7 @@ expredir(union node *n) for (redir = n ; redir ; redir = redir->nfile.next) { struct arglist fn; + memset(&fn, 0, sizeof(struct arglist)); fn.lastp = &fn.list; switch (redir->type) { case NFROMTO: @@ -3056,7 +3057,10 @@ expredir(union node *n) case NTOFD: if (redir->ndup.vname) { expandarg(redir->ndup.vname, &fn, EXP_FULL | EXP_TILDE); - fixredir(redir, fn.list->text, 1); + if (fn.list != NULL) + fixredir(redir, fn.list->text, 1); + else + sh_error("redir error"); } break; }