summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorevan <evanbonner99@gmail.com>2023-03-06 20:46:16 +0000
committerevan <evanbonner99@gmail.com>2023-03-06 20:46:16 +0000
commitd442ab79ca91616ab15acb342013e489db5b67c2 (patch)
tree7864c2967dac3a3753e7c588f646e8e4a373892e
parentb4cfc3fef326f78b8c683707f0819886ddcd82bd (diff)
Fix buffer overrun in yylex
-rw-r--r--src/lex.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/lex.c b/src/lex.c
index c71fef1..1b70241 100644
--- a/src/lex.c
+++ b/src/lex.c
@@ -157,23 +157,23 @@ int yylex() {
ret = WORD;
if (!linelim || isfunc) {
if (isfunc) isfunc--;
- for (tblp = linelim ? experres : statres; tblp->key; tblp++)
- if (((tblp->key[0]^tokenst[0])&0137)==0
- && tblp->key[tokenl]==0) {
- int i = 1;
- while (i<tokenl && ((tokenst[i]^tblp->key[i])&0137)==0)
- i++;
- if (i >= tokenl) {
- ret = tblp->val;
- colstate = (ret <= S_FORMAT);
- if (isgoto) {
- isfunc = isgoto = 0;
- if (ret != K_ERROR && ret != K_INVALID)
- ret = WORD;
+ for (tblp = linelim ? experres : statres; tblp->key; tblp++) {
+ if (((tblp->key[0]^tokenst[0])&0137)==0) {
+ int i = 1;
+ while (i<tokenl && ((tokenst[i]^tblp->key[i])&0137)==0)
+ i++;
+ if (i >= tokenl) {
+ ret = tblp->val;
+ colstate = (ret <= S_FORMAT);
+ if (isgoto) {
+ isfunc = isgoto = 0;
+ if (ret != K_ERROR && ret != K_INVALID)
+ ret = WORD;
}
break;
}
}
+ }
}
if (ret == WORD) {