From e98f89c84ec0492a36e364ac32987e17296b33df Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Fri, 6 Jan 2023 08:04:26 -0800 Subject: no obvious memory problems --- src/stack.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/stack.c') 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]; } -- cgit