commit e69e81b1bc739988bad1e37c01c6d70a1a518a5a
parent c6dd2dacda6c093f1a7d3c9786f64f4294e390a1
Author: Quentin Rameau <quinq@fifth.space>
Date: Fri, 31 Mar 2017 18:07:56 +0200
[cc2] Fix array overflow checks in parser.c
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git 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;