summaryrefslogtreecommitdiff
path: root/core/tokbuf.c
diff options
context:
space:
mode:
authorChloe M. <chloe@mirocom.org>2026-05-23 14:36:20 +0000
committerChloe M. <chloe@mirocom.org>2026-05-23 14:36:20 +0000
commit19c7587f28a8b3de2ad161020d4673c674af343b (patch)
treea112bf3f1ba64176720165f41dd6b02615dc5dc4 /core/tokbuf.c
parent5f726024711e0c803a50e3124820d7d4b214dd93 (diff)
core: tokbuf: Fix buffer overflow
Signed-off-by: Chloe M. <chloe@mirocom.org>
Diffstat (limited to 'core/tokbuf.c')
-rw-r--r--core/tokbuf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/tokbuf.c b/core/tokbuf.c
index e880c15..05e8755 100644
--- a/core/tokbuf.c
+++ b/core/tokbuf.c
@@ -30,7 +30,7 @@ tokbuf_push(struct tokbuf *tokbuf, struct token *tok)
return -1;
}
- if ((tokbuf->head++) >= TOKBUF_CAP) {
+ if ((tokbuf->head++) >= TOKBUF_CAP - 1) {
tokbuf->head = 0;
}