[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [PATCH] hush: Prevent segfault at unexpected EOF in script.
From: Denys Vlasenko <vda.linux () googlemail ! com>
Date: 2024-02-25 14:38:21
Message-ID: CAK1hOcPQ=+hE+SLERh-VjdY1V0P1BVwmr_VBFjuvV5UhPgbUtg () mail ! gmail ! com
[Download RAW message or body]
On Sat, Feb 10, 2024 at 4:51 PM Dmitry Chestnykh <dm.chestnykh@gmail.com> wrote:
> See https://bugs.buildroot.org/show_bug.cgi?id=15937 .
> With this patch the execution of reproducer script
> from bugzilla leads to the following output:
> 'hush: syntax error: unexpected EOF'
>
> Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
> ---
> shell/hush.c | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/shell/hush.c b/shell/hush.c
> index ca01e2b5b..0595ad592 100644
> --- a/shell/hush.c
> +++ b/shell/hush.c
> @@ -6132,6 +6132,10 @@ static int expand_on_ifs(o_string *output, int n, const char *str)
>
> if (!*str) /* EOL - do not finalize word */
> break;
> +
> + if (!G.ifs)
> + return -1;
> +
The bug is that G.ifs is NULL. It was intended to be always non-NULL.
Setting it only in run_pipe() is too late: the parsing of first statement
already may require IFS splitting.
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic