Properly increment line lenght on edge-case in getlines()

This commit is contained in:
FRIGN 2016-02-29 15:45:16 +01:00 committed by sin
parent eb9bda8787
commit 19c0ca9830

View File

@ -27,5 +27,6 @@ getlines(FILE *fp, struct linebuf *b)
b->lines[b->nlines - 1].data = erealloc(b->lines[b->nlines - 1].data, linelen + 2); b->lines[b->nlines - 1].data = erealloc(b->lines[b->nlines - 1].data, linelen + 2);
b->lines[b->nlines - 1].data[linelen] = '\n'; b->lines[b->nlines - 1].data[linelen] = '\n';
b->lines[b->nlines - 1].data[linelen + 1] = '\0'; b->lines[b->nlines - 1].data[linelen + 1] = '\0';
b->lines[b->nlines - 1].len++;
} }
} }