From 60d16fd50aaaf4fec3014376f14cea62cb9aa5a9 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Wed, 8 May 2019 01:38:19 -0700 Subject: Fail on invalid token Reading a zero-length TIdnt token causes infinite loops or other failures. --- yacc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/yacc.c b/yacc.c index 01f054e..8ea5137 100644 --- a/yacc.c +++ b/yacc.c @@ -837,6 +837,8 @@ nexttk() die("identifier too long"); c = fgetc(fin); } + if (p == idnt) + die("unknown token"); *p = 0; if (strcmp(idnt, "%")==0) if (c=='{') -- cgit v1.2.3