[PATCH 2/3] Revert "ash: fix a SEGV case in an invalid heredoc" xxx
Natanael Copa
ncopa at alpinelinux.org
Thu Oct 29 12:13:15 UTC 2015
On Thu, 29 Oct 2015 11:30:22 +0000
Ron Yorston <rmy at pobox.com> wrote:
> This reverts commit 7e66102f762a7d80715f0c7e5925433256b78cee but
> leaves the test in place as it's still valid.
>
> Reported-by: Natanael Copa <ncopa at alpinelinux.org>
> Signed-off-by: Ron Yorston <rmy at pobox.com>
> ---
> shell/ash.c | 15 ++++-----------
> 1 file changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/shell/ash.c b/shell/ash.c
> index 17121aa..86d648a 100644
> --- a/shell/ash.c
> +++ b/shell/ash.c
> @@ -10516,7 +10516,7 @@ static union node *andor(void);
> static union node *pipeline(void);
> static union node *parse_command(void);
> static void parseheredoc(void);
> -static char nexttoken_ends_list(void);
> +static char peektoken(void);
> static int readtoken(void);
>
> static union node *
> @@ -10526,7 +10526,7 @@ list(int nlflag)
> int tok;
>
> checkkwd = CHKNL | CHKKWD | CHKALIAS;
> - if (nlflag == 2 && nexttoken_ends_list())
> + if (nlflag == 2 && peektoken())
> return NULL;
> n1 = NULL;
> for (;;) {
> @@ -10568,15 +10568,8 @@ list(int nlflag)
> tokpushback = 1;
> }
> checkkwd = CHKNL | CHKKWD | CHKALIAS;
> - if (nexttoken_ends_list()) {
> - /* Testcase: "<<EOF; then <W".
> - * It used to segfault w/o this check:
> - */
> - if (heredoclist) {
> - raise_error_unexpected_syntax(-1);
> - }
> + if (peektoken())
> return n1;
> - }
> break;
> case TEOF:
> if (heredoclist)
> @@ -11955,7 +11948,7 @@ readtoken(void)
> }
>
> static char
> -nexttoken_ends_list(void)
> +peektoken(void)
I think this will not work. peektoken and nexttoken_ends_lists are not
same thing.
I know you correct it in next commit but i think it may break things
for future git bisect.
> {
> int t;
>
-nc
More information about the busybox
mailing list