From: Todd C. Miller Date: Mon, 6 Jan 2003 23:47:04 +0000 (+0000) Subject: Work around what appears to be a flex bug when dealing with files X-Git-Tag: SUDO_1_6_7~92 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cce84a181144de6b39b9deec26862f9dba305dd0;p=sudo Work around what appears to be a flex bug when dealing with files that lack a final newline before EOF. This adds a rule to match EOF in the non-initial states which resets the state to INITIAL and throws an error. --- diff --git a/parse.lex b/parse.lex index 0ce1dc5c2..0f997d8d8 100644 --- a/parse.lex +++ b/parse.lex @@ -339,6 +339,12 @@ PASSWD[[:blank:]]*: { return(COMMENT); } /* return comments */ +<> { + BEGIN INITIAL; + LEXTRACE("EOF "); + return(ERROR); + } /* premature EOF */ + <*>. { LEXTRACE("ERROR "); return(ERROR);