AmendHub

Download (as of this amendment):

jcs

/

amend

/

amendments

/

201

util: Fix off-by-one in FSReadLine


jcs made amendment 201 3 days ago
--- util.c Sun Oct 4 12:03:40 2026 +++ util.c Fri Oct 16 16:14:30 2026 @@ -1393,8 +1393,8 @@ FSReadLine(short frefnum, char *buf, size_t buflen) GetFPos(frefnum, &pos); GetEOF(frefnum, &fsize); - for (; pos <= fsize; pos++) { - if (total_read > buflen) + for (; pos < fsize; pos++) { + if (total_read >= buflen) return -1; error = FSRead(frefnum, &rlen, &tbuf);