Just let read_line() zero-terminate the intermediate buffer when the line is complete.
Attach a file by drag & drop or click to upload