summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney2019-05-08 01:38:19 -0700
committerQuentin Carbonneaux2019-05-15 10:52:47 +0200
commit60d16fd50aaaf4fec3014376f14cea62cb9aa5a9 (patch)
tree86703ecfa933db32398301d46bf3f1a4ab68d01e
parente3827acb73055d2e3b16deaecd83574af7a08399 (diff)
Fail on invalid token
Reading a zero-length TIdnt token causes infinite loops or other failures.
-rw-r--r--yacc.c2
1 files changed, 2 insertions, 0 deletions
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=='{')