* Fix a bug in the fgetln() implementation. The newline was not properly

accounted for in the returned length.
This commit is contained in:
Sam Hocevar
2007-01-06 22:17:09 +00:00
committed by sam
parent c2d12ddd92
commit f62025e392

View File

@@ -436,7 +436,7 @@ char *fgetln(FILE *stream, size_t *len)
fuzz = _zz_getfuzz(fd);
for(i = size = 0; ; i++)
for(i = size = 0; ; /* i is incremented below */)
{
int ch;
@@ -454,7 +454,7 @@ char *fgetln(FILE *stream, size_t *len)
_zz_fuzz(fd, (uint8_t *)fuzz->tmp + i, 1); /* rather inefficient */
_zz_addpos(fd, 1);
if(fuzz->tmp[i] == '\n')
if(fuzz->tmp[i++] == '\n')
break;
}