In function `fgets_until`, `if (i >= n-1) break;` should be `if (i >= n-2) break;` to avoid writing outside the allocated memory.
In function
fgets_until,if (i >= n-1) break;should beif (i >= n-2) break;to avoid writing outside the allocated memory.