core: tokbuf: Fix buffer overflow
Signed-off-by: Chloe M. <chloe@mirocom.org>
This commit is contained in:
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user