Skip to content

Commit 6c9d195

Browse files
committed
Merge branch 'rs/strbuf-getwholeline-fix' into maint
A helper function to read a single whole line into strbuf mistakenly triggered OOM error at EOF under certain conditions, which has been fixed. * rs/strbuf-getwholeline-fix: strbuf: clear errno before calling getdelim(3)
2 parents 4010f1d + 642956c commit 6c9d195

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

strbuf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ int strbuf_getwholeline(struct strbuf *sb, FILE *fp, int term)
476476
/* Translate slopbuf to NULL, as we cannot call realloc on it */
477477
if (!sb->alloc)
478478
sb->buf = NULL;
479+
errno = 0;
479480
r = getdelim(&sb->buf, &sb->alloc, term, fp);
480481

481482
if (r > 0) {

0 commit comments

Comments
 (0)