sh: Fix a crash if a heredoc was not properly ended and parsing continued.

Example (in interactive mode):
  cat <<EOF && )
The next command typed caused sh to segfault, because the state for the here
document was not reset.

Like parser_temp, this uses the fact that the parser is not re-entered.
This commit is contained in:
Jilles Tjoelker 2010-05-30 14:20:32 +00:00
parent ba02a307fe
commit 5d91007000
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=208656
2 changed files with 6 additions and 0 deletions

View File

@ -203,6 +203,7 @@ parsecmd(int interact)
* which could happen if we add command substitution on PS1/PS2.
*/
parser_temp_free_all();
heredoclist = NULL;
tokpushback = 0;
doprompt = interact;

View File

@ -0,0 +1,5 @@
# $FreeBSD$
r=
! command eval ": <<EOF; )" 2>/dev/null; command eval : hi \${r:=0}
exit ${r:-3}