diff options
author | Preston Pan <preston@nullring.xyz> | 2023-01-06 08:04:26 -0800 |
---|---|---|
committer | Preston Pan <preston@nullring.xyz> | 2023-01-06 08:04:26 -0800 |
commit | e98f89c84ec0492a36e364ac32987e17296b33df (patch) | |
tree | 7a306f7a148cee12a0c8f216e347c548875e2e75 /src/stack.c | |
parent | 6c1e4bbfe920feda675d8ea3a13281742d55c334 (diff) |
no obvious memory problems
Diffstat (limited to 'src/stack.c')
-rw-r--r-- | src/stack.c | 4 |
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]; } |