From bf59f0ed282f9c9b1ae0660e5af0ac86c0d247b5 Mon Sep 17 00:00:00 2001 From: Neven Sajko Date: Sun, 25 Aug 2019 14:30:36 +0000 Subject: cmd/yacc: correctly detect end of file in gettok This prevents an infinite loop. Change-Id: I7eda6b9d032ca0daeb24b555954330d07f35c78b --- src/cmd/yacc.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/cmd') diff --git a/src/cmd/yacc.c b/src/cmd/yacc.c index 32698c2a..bd3f6aa4 100644 --- a/src/cmd/yacc.c +++ b/src/cmd/yacc.c @@ -1805,6 +1805,8 @@ begin: } } else return c; + if(c == Beof) + return ENDFILE; Bungetrune(finput); } tokname[i] = 0; -- cgit v1.2.3