]> granicus.if.org Git - sudo/commitdiff
Work around what appears to be a flex bug when dealing with files
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 6 Jan 2003 23:47:04 +0000 (23:47 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 6 Jan 2003 23:47:04 +0000 (23:47 +0000)
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.

parse.lex

index 0ce1dc5c260ec5b3e6128132a6a2244c38f25d58..0f997d8d8838266b1786d997377966ef7ebad2d0 100644 (file)
--- a/parse.lex
+++ b/parse.lex
@@ -339,6 +339,12 @@ PASSWD[[:blank:]]*:        {
                            return(COMMENT);
                        }                       /* return comments */
 
+<GOTRUNAS,GOTDEFS,GOTCMND,STARTDEFS,INDEFS><<EOF>> {
+                           BEGIN INITIAL;
+                           LEXTRACE("EOF ");
+                           return(ERROR);
+                       }       /* premature EOF */
+
 <*>.                   {
                            LEXTRACE("ERROR ");
                            return(ERROR);