commit e69e81b1bc739988bad1e37c01c6d70a1a518a5a
Author:     Quentin Rameau <[email protected]>
AuthorDate: Fri Mar 31 18:07:56 2017 +0200
Commit:     Quentin Rameau <[email protected]>
CommitDate: Fri Mar 31 18:11:46 2017 +0200

    [cc2] Fix array overflow checks in parser.c

diff --git a/cc2/parser.c b/cc2/parser.c
index f19f5f0..27ebcea 100644
--- a/cc2/parser.c
+++ b/cc2/parser.c
@@ -154,7 +154,7 @@ static void *stack[STACKSIZ], **sp = stack;
 static Node *
 push(void *elem)
 {
-       if (sp == stack[STACKSIZ])
+       if (sp == &stack[STACKSIZ])
                error(ESTACKO);
        return *sp++ = elem;
 }
@@ -387,7 +387,7 @@ bswitch(char *token, union tokenop u)
        struct swtch *cur;
        Node *np = newnode(u.op);
 
-       if (swp == &swtbl[NR_BLOCK+1])
+       if (swp == &swtbl[NR_BLOCK])
                error(EWTACKO);
        cur = swp++;
        cur->nr = 0;

Reply via email to