summaryrefslogtreecommitdiff
path: root/lib/md5.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/md5.c')
-rw-r--r--lib/md5.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/md5.c b/lib/md5.c
index a9b65b0191..ea69a59d8e 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -170,6 +170,12 @@ md5_stream (FILE *stream, void *resblock)
/* Read block. Take care for partial reads. */
while (1)
{
+ /* Either process a partial fread() from this loop,
+ or the fread() in afalg_stream may have gotten EOF.
+ We need to avoid a subsequent fread() due to glibc BZ 1190. */
+ if (feof (stream))
+ goto process_partial_block;
+
n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
sum += n;
@@ -189,12 +195,6 @@ md5_stream (FILE *stream, void *resblock)
}
goto process_partial_block;
}
-
- /* We've read at least one byte, so ignore errors. But always
- check for EOF, since feof may be true even though N > 0.
- Otherwise, we could end up calling fread after EOF. */
- if (feof (stream))
- goto process_partial_block;
}
/* Process buffer with BLOCKSIZE bytes. Note that