Revert "ash: fix a SEGV case in an invalid heredoc" xxx

This reverts commit 7e66102f76 but
leaves the test in place as it's still valid.

Reported-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
pull/1/head
Ron Yorston 2015-10-29 11:30:22 +00:00 committed by Denys Vlasenko
parent 713f07d906
commit 6bd2fabc52
1 changed files with 4 additions and 11 deletions

View File

@ -10524,7 +10524,7 @@ static union node *andor(void);
static union node *pipeline(void); static union node *pipeline(void);
static union node *parse_command(void); static union node *parse_command(void);
static void parseheredoc(void); static void parseheredoc(void);
static char nexttoken_ends_list(void); static char peektoken(void);
static int readtoken(void); static int readtoken(void);
static union node * static union node *
@ -10534,7 +10534,7 @@ list(int nlflag)
int tok; int tok;
checkkwd = CHKNL | CHKKWD | CHKALIAS; checkkwd = CHKNL | CHKKWD | CHKALIAS;
if (nlflag == 2 && nexttoken_ends_list()) if (nlflag == 2 && peektoken())
return NULL; return NULL;
n1 = NULL; n1 = NULL;
for (;;) { for (;;) {
@ -10576,15 +10576,8 @@ list(int nlflag)
tokpushback = 1; tokpushback = 1;
} }
checkkwd = CHKNL | CHKKWD | CHKALIAS; checkkwd = CHKNL | CHKKWD | CHKALIAS;
if (nexttoken_ends_list()) { if (peektoken())
/* Testcase: "<<EOF; then <W".
* It used to segfault w/o this check:
*/
if (heredoclist) {
raise_error_unexpected_syntax(-1);
}
return n1; return n1;
}
break; break;
case TEOF: case TEOF:
if (heredoclist) if (heredoclist)
@ -11962,7 +11955,7 @@ readtoken(void)
} }
static char static char
nexttoken_ends_list(void) peektoken(void)
{ {
int t; int t;