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
ba02a307fe
commit
5d91007000
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=208656
@ -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…
Reference in New Issue
Block a user