diff options
| author | Ron Yorston <rmy@pobox.com> | 2015-10-29 11:30:22 +0000 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2015-10-29 21:42:30 +0100 |
| commit | 6bd2fabc52fa76b69a65772878e2e745c0fff3ff (patch) | |
| tree | 1ea2f98ad16dd7199e0a311d951078c0c40ea1fb /shell | |
| parent | 713f07d906d9171953be0c12e2369869855b6ca6 (diff) | |
| download | busybox-w32-6bd2fabc52fa76b69a65772878e2e745c0fff3ff.tar.gz busybox-w32-6bd2fabc52fa76b69a65772878e2e745c0fff3ff.tar.bz2 busybox-w32-6bd2fabc52fa76b69a65772878e2e745c0fff3ff.zip | |
Revert "ash: fix a SEGV case in an invalid heredoc" xxx
This reverts commit 7e66102f762a7d80715f0c7e5925433256b78cee 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>
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/ash.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/shell/ash.c b/shell/ash.c index 384c7b9e4..72fc7d524 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
| @@ -10524,7 +10524,7 @@ static union node *andor(void); | |||
| 10524 | static union node *pipeline(void); | 10524 | static union node *pipeline(void); |
| 10525 | static union node *parse_command(void); | 10525 | static union node *parse_command(void); |
| 10526 | static void parseheredoc(void); | 10526 | static void parseheredoc(void); |
| 10527 | static char nexttoken_ends_list(void); | 10527 | static char peektoken(void); |
| 10528 | static int readtoken(void); | 10528 | static int readtoken(void); |
| 10529 | 10529 | ||
| 10530 | static union node * | 10530 | static union node * |
| @@ -10534,7 +10534,7 @@ list(int nlflag) | |||
| 10534 | int tok; | 10534 | int tok; |
| 10535 | 10535 | ||
| 10536 | checkkwd = CHKNL | CHKKWD | CHKALIAS; | 10536 | checkkwd = CHKNL | CHKKWD | CHKALIAS; |
| 10537 | if (nlflag == 2 && nexttoken_ends_list()) | 10537 | if (nlflag == 2 && peektoken()) |
| 10538 | return NULL; | 10538 | return NULL; |
| 10539 | n1 = NULL; | 10539 | n1 = NULL; |
| 10540 | for (;;) { | 10540 | for (;;) { |
| @@ -10576,15 +10576,8 @@ list(int nlflag) | |||
| 10576 | tokpushback = 1; | 10576 | tokpushback = 1; |
| 10577 | } | 10577 | } |
| 10578 | checkkwd = CHKNL | CHKKWD | CHKALIAS; | 10578 | checkkwd = CHKNL | CHKKWD | CHKALIAS; |
| 10579 | if (nexttoken_ends_list()) { | 10579 | if (peektoken()) |
| 10580 | /* Testcase: "<<EOF; then <W". | ||
| 10581 | * It used to segfault w/o this check: | ||
| 10582 | */ | ||
| 10583 | if (heredoclist) { | ||
| 10584 | raise_error_unexpected_syntax(-1); | ||
| 10585 | } | ||
| 10586 | return n1; | 10580 | return n1; |
| 10587 | } | ||
| 10588 | break; | 10581 | break; |
| 10589 | case TEOF: | 10582 | case TEOF: |
| 10590 | if (heredoclist) | 10583 | if (heredoclist) |
| @@ -11962,7 +11955,7 @@ readtoken(void) | |||
| 11962 | } | 11955 | } |
| 11963 | 11956 | ||
| 11964 | static char | 11957 | static char |
| 11965 | nexttoken_ends_list(void) | 11958 | peektoken(void) |
| 11966 | { | 11959 | { |
| 11967 | int t; | 11960 | int t; |
| 11968 | 11961 | ||
