minitox.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/minitox.c b/minitox.c
index 50c4bcd..6fc05ca 100644
--- a/minitox.c
+++ b/minitox.c
@@ -499,6 +499,9 @@ int arepl_readline(struct AsyncREPL *arepl, char c, char *line, size_t sz){
}
// fall through to default case
default:
+ if ((size_t)(arepl->nbuf + arepl->nstack) >= arepl->sz - 1) {
+ break;
+ }
arepl->line[arepl->nbuf++] = c;
}
return 0;