svn commit: r283055 - stable/9/lib/libmd

Garrett Cooper ngie at FreeBSD.org
Mon May 18 10:46:52 UTC 2015


Author: ngie
Date: Mon May 18 10:46:51 2015
New Revision: 283055
URL: https://svnweb.freebsd.org/changeset/base/283055

Log:
  MFstable/10 r283054:
  
  MFC r281928:
  
  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:
  stable/9/lib/libmd/mdXhl.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/lib/   (props changed)

Modified: stable/9/lib/libmd/mdXhl.c
==============================================================================
--- stable/9/lib/libmd/mdXhl.c	Mon May 18 10:45:18 2015	(r283054)
+++ stable/9/lib/libmd/mdXhl.c	Mon May 18 10:46:51 2015	(r283055)
@@ -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-stable-9 mailing list