From 7e910a7d23348cbccf95d0339aa42fedadea1711 Mon Sep 17 00:00:00 2001 From: Ali Gholami Rudi Date: Wed, 14 Jul 2010 20:35:38 +0430 Subject: [PATCH] tok: don't go beyond buf len for 3-char tokens --- tok.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tok.c b/tok.c index 8320024..4647a15 100644 --- a/tok.c +++ b/tok.c @@ -47,7 +47,7 @@ static struct { }; static char *tok3[] = { - "<<", ">>", "++", "--", "<<=", ">>=", "...", "+=", "-=", "*=", "/=", + "<<=", ">>=", "...", "<<", ">>", "++", "--", "+=", "-=", "*=", "/=", "%=", "|=", "&=", "^=", "&&", "||", "==", "!=", "<=", ">=", "->", "/*" }; @@ -243,7 +243,7 @@ int tok_get(void) return kwds[i].id; return TOK_NAME; } - if ((num = get_tok3(TOK3(buf + cur)))) { + if (cur + 3 <= len && (num = get_tok3(TOK3(buf + cur)))) { cur += 3; return num; } -- 2.11.4.GIT