[git commit branch/1_24_stable] Revert "ash: fix a SEGV case in an invalid heredoc" xxx

Mike Frysinger vapier at gentoo.org
Tue Mar 22 22:21:28 UTC 2016


commit: https://git.busybox.net/busybox/commit/?id=acad7392ee734ec286f0ae2b2e4550b5b4f49c10
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/1_24_stable

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>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
Signed-off-by: Mike Frysinger <vapier at gentoo.org>
(cherry picked from commit 6bd2fabc52fa76b69a65772878e2e745c0fff3ff)
---
 shell/ash.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/shell/ash.c b/shell/ash.c
index 96aa2a2..48b7c4f 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -10518,7 +10518,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 *
@@ -10528,7 +10528,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 (;;) {
@@ -10570,15 +10570,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)
@@ -11958,7 +11951,7 @@ readtoken(void)
 }
 
 static char
-nexttoken_ends_list(void)
+peektoken(void)
 {
 	int t;
 


More information about the busybox-cvs mailing list