diff options
Diffstat (limited to 'shell/hush.c')
| -rw-r--r-- | shell/hush.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/shell/hush.c b/shell/hush.c index f776a6468..1495db373 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -4202,6 +4202,10 @@ static void initialize_context(struct parse_context *ctx) * ctx->command = &ctx->pipe->cmds[0]; */ done_command(ctx); + /* If very first arg is "" or '', ctx.word.data may end up NULL. + * Prevent this: + */ + ctx->word.data = xzalloc(1); /* start as "", not as NULL */ } /* If a reserved word is found and processed, parse context is modified @@ -5840,11 +5844,6 @@ static struct pipe *parse_stream(char **pstring, enable_all_aliases(); initialize_context(&ctx); - /* If very first arg is "" or '', ctx.word.data may end up NULL. - * Preventing this: - */ - ctx.word.data = xzalloc(1); /* start as "", not as NULL */ - /* We used to separate words on $IFS here. This was wrong. * $IFS is used only for word splitting when $var is expanded, * here we should use blank chars as separators, not $IFS |
