svn commit: r281928 - head/lib/libmd
Garrett Cooper
ngie at FreeBSD.org
Fri Apr 24 11:03:48 UTC 2015
Author: ngie
Date: Fri Apr 24 11:03:47 2015
New Revision: 281928
URL: https://svnweb.freebsd.org/changeset/base/281928
Log:
Avoid an infinite loop by ensuring that the amount of bytes read is greater
than 0 in MDXFileChunk when calculating the checksum
This edgecase can be triggered if the file is truncated while the checksum
is being calculated (i.e. the EOF is reached)
Differential Revision: https://reviews.freebsd.org/D2351 (patch by darius)
PR: 196694
Reviewed by: delphij, ngie
Submitted by: Daniel O'Connor <darius at dons.net.au>
Sponsored by: EMC / Isilon Storage Division
Modified:
head/lib/libmd/mdXhl.c
Modified: head/lib/libmd/mdXhl.c
==============================================================================
--- head/lib/libmd/mdXhl.c Fri Apr 24 10:21:20 2015 (r281927)
+++ head/lib/libmd/mdXhl.c Fri Apr 24 11:03:47 2015 (r281928)
@@ -74,7 +74,7 @@ MDXFileChunk(const char *filename, char
i = read(f, buffer, sizeof(buffer));
else
i = read(f, buffer, n);
- if (i < 0)
+ if (i <= 0)
break;
MDXUpdate(&ctx, buffer, i);
n -= i;
More information about the svn-src-all
mailing list