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:
parent
930ce39226
commit
e65f4ccf95
@ -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;
|
||||
|
5
tools/regression/bin/sh/parser/heredoc6.0
Normal file
5
tools/regression/bin/sh/parser/heredoc6.0
Normal file
@ -0,0 +1,5 @@
|
||||
# $FreeBSD$
|
||||
|
||||
r=
|
||||
! command eval ": <<EOF; )" 2>/dev/null; command eval : hi \${r:=0}
|
||||
exit ${r:-3}
|
Loading…
x
Reference in New Issue
Block a user