[hackers] [scc] [cc2] Fix array overflow checks in parser.c || Quentin Rameau

From: <git_AT_suckless.org>
Date: Fri, 31 Mar 2017 18:12:25 +0200 (CEST)

commit e69e81b1bc739988bad1e37c01c6d70a1a518a5a
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Fri Mar 31 18:07:56 2017 +0200
Commit: Quentin Rameau <quinq_AT_fifth.space>
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
_AT_@ -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;
 }
_AT_@ -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;
Received on Fri Mar 31 2017 - 18:12:25 CEST

This archive was generated by hypermail 2.3.0 : Fri Mar 31 2017 - 18:24:18 CEST