core: tokbuf: Fix buffer overflow

Signed-off-by: Chloe M. <chloe@mirocom.org>
This commit is contained in:
2026-05-23 14:36:20 +00:00
parent 5f72602471
commit 19c7587f28
+1 -1
View File
@@ -30,7 +30,7 @@ tokbuf_push(struct tokbuf *tokbuf, struct token *tok)
return -1; return -1;
} }
if ((tokbuf->head++) >= TOKBUF_CAP) { if ((tokbuf->head++) >= TOKBUF_CAP - 1) {
tokbuf->head = 0; tokbuf->head = 0;
} }