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 <dar...@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;
_______________________________________________
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