git.strcat.st

/strcat/minitox.git/ - summarytreelogarchive

subject
prevent line buffer overflow in arepl_readline
commit
8a921ee167ae797b9309a9768019d6c84e69f120
date
2026-04-17T20:40:11Z
message
diff
 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;