From 503a62a82284b00137a18e4aad24e00b71175a93 Mon Sep 17 00:00:00 2001 From: Hojun-Cho Date: Fri, 27 Dec 2024 22:35:10 +0900 Subject: [PATCH] lex/parser.y fix Segmentation fault Check the EOF first. --- src/cmd/lex/parser.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/lex/parser.y b/src/cmd/lex/parser.y index 964a60fe..358d5397 100644 --- a/src/cmd/lex/parser.y +++ b/src/cmd/lex/parser.y @@ -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)); }