overflow errors

This commit is contained in:
2026-06-03 14:09:01 +02:00
parent 564292b03e
commit 23f7701eb9
12 changed files with 240 additions and 157 deletions
+6 -3
View File
@@ -158,10 +158,13 @@ char *editorPrompt(char *prompt, char *placeHolder, char bPathMode) {
} else if (!iscntrl(c) && c < 256) {
if (buf_len == buf_size - 1) {
buf_size *= 2;
buf = realloc(buf, buf_size);
char *new_buf = realloc(buf, buf_size);
if (!new_buf) {
free(buf);
return NULL;
}
buf = new_buf;
}
buf[buf_len++] = (char)c;
buf[buf_len] = '\0';
}
}
}