about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/parse.c8
2 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index fdf08f3a9..59b34afbb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -35,6 +35,11 @@
 	* 20358: Completion/Unix/Command/_make: avoid potential gawk
 	  locale bug by not using awk.
 
+2004-09-29  Bart Schaefer  <schaefer@zsh.org>
+
+	* 20418: Src/parse.c: fix crash-inducing bug with mis-parsing of
+	incomplete pipeline expressions (e.g. "zsh -c 'echo |').
+
 2004-09-28  Clint Adams  <clint@zsh.org>
 
 	* 20414: Completion/Unix/Type/_diff_options: correct missing
diff --git a/Src/parse.c b/Src/parse.c
index 551573f5a..d0f108333 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -729,7 +729,9 @@ par_pline(int *complex)
 	ecbuf[p] = WCB_PIPE(WC_PIPE_MID, (line >= 0 ? line + 1 : 0));
 	ecispace(p + 1, 1);
 	ecbuf[p + 1] = ecused - 1 - p;
-	par_pline(complex);
+	if (!par_pline(complex)) {
+	    tok = LEXERR;
+	}
 	cmdpop();
 	return 1;
     } else if (tok == BARAMP) {
@@ -750,7 +752,9 @@ par_pline(int *complex)
 	ecbuf[p] = WCB_PIPE(WC_PIPE_MID, (line >= 0 ? line + 1 : 0));
 	ecispace(p + 1, 1);
 	ecbuf[p + 1] = ecused - 1 - p;
-	par_pline(complex);
+	if (!par_pline(complex)) {
+	    tok = LEXERR;
+	}
 	cmdpop();
 	return 1;
     } else {