summaryrefslogtreecommitdiff
path: root/src/stack.c
diff options
context:
space:
mode:
authorPreston Pan <preston@nullring.xyz>2023-01-06 08:04:26 -0800
committerPreston Pan <preston@nullring.xyz>2023-01-06 08:04:26 -0800
commite98f89c84ec0492a36e364ac32987e17296b33df (patch)
tree7a306f7a148cee12a0c8f216e347c548875e2e75 /src/stack.c
parent6c1e4bbfe920feda675d8ea3a13281742d55c334 (diff)
no obvious memory problems
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];
}