Skip to content

Commit

Permalink
lex/parser.y fix Segmentation fault
Browse files Browse the repository at this point in the history
Check the EOF first.
  • Loading branch information
Hojun-Cho committed Dec 27, 2024
1 parent 61e362a commit 503a62a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cmd/lex/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ yylex(void)
if(debug)
Bprint(&fout,"\n/*this comes from section three - debug */\n");
# endif
while(getl(buf) && !eof)
while(!eof && getl(buf))
Bprint(&fout,"%s\n",(char*)buf);
return(freturn(0));
}
Expand Down

0 comments on commit 503a62a

Please sign in to comment.