summaryrefslogtreecommitdiff
path: root/src/stack.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stack.c')
-rw-r--r--src/stack.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/stack.c b/src/stack.c
index c5e753e..2438792 100644
--- a/src/stack.c
+++ b/src/stack.c
@@ -24,9 +24,9 @@ void stack_push(stack_t *s, hash_table_t *h) {
s->cur++;
s->stack[s->cur] = h;
}
-
+/* fix heap buffer overflow */
hash_table_t *stack_peek(stack_t *s) {
- if (s->stack == NULL)
+ if (s->cur == -1)
return NULL;
return s->stack[s->cur];
}