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

Log:
  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 <dar...@dons.net.au>
  Sponsored by: EMC / Isilon Storage Division

Modified:
  stable/10/lib/libmd/mdXhl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libmd/mdXhl.c
==============================================================================
--- stable/10/lib/libmd/mdXhl.c Mon May 18 10:31:23 2015        (r283053)
+++ stable/10/lib/libmd/mdXhl.c Mon May 18 10:45:18 2015        (r283054)
@@ -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;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to