about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2022-06-08 20:48:42 -0700
committerBart Schaefer <schaefer@zsh.org>2022-06-08 20:48:42 -0700
commit734740a5ed52d236f3893cc738fb09c7203a5138 (patch)
treea24c2e7e9dfbcc7e6e5149b0f31528e41f920a52
parent52761c94185f8405d8069c1d4bacc8b5210a1850 (diff)
downloadzsh-734740a5ed52d236f3893cc738fb09c7203a5138.tar.gz
zsh-734740a5ed52d236f3893cc738fb09c7203a5138.tar.xz
zsh-734740a5ed52d236f3893cc738fb09c7203a5138.zip
50341: disallow here-document markers containing newline
-rw-r--r--ChangeLog2
-rw-r--r--Src/parse.c3
2 files changed, 5 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index c13d8a163..b16668984 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2022-06-08  Bart Schaefer  <schaefer@zsh.org>
 
+	* 50341: Src/parse.c: disallow here-doc markers containing newline
+
 	* 50335: Functions/Misc/zargs: simplify "wait" usage, fix signal
 	handling for functions used as the command.
 
diff --git a/Src/parse.c b/Src/parse.c
index d612b7e17..5054e59d5 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -2248,6 +2248,9 @@ par_redir(int *rp, char *idstring)
 	struct heredocs **hd;
 	int htype = type;
 
+	if (strchr(tokstr, '\n'))
+	    YYERROR(ecused);
+
 	/*
 	 * Add two here for the string to remember the HERE
 	 * terminator in raw and munged form.