svn commit: r304269 - projects/fix-libarchive-tests-after-r304075/contrib/libarchive/libarchive/test

Garrett Cooper ngie at FreeBSD.org
Wed Aug 17 07:30:24 UTC 2016


Author: ngie
Date: Wed Aug 17 07:30:23 2016
New Revision: 304269
URL: https://svnweb.freebsd.org/changeset/base/304269

Log:
  Ensure that f has been properly fopen'ed before trying to fwrite to it
  
  CID:		1331454
  Reported by:	Coverity
  Sponsored by:	EMC / Isilon Storage Division

Modified:
  projects/fix-libarchive-tests-after-r304075/contrib/libarchive/libarchive/test/test_fuzz.c

Modified: projects/fix-libarchive-tests-after-r304075/contrib/libarchive/libarchive/test/test_fuzz.c
==============================================================================
--- projects/fix-libarchive-tests-after-r304075/contrib/libarchive/libarchive/test/test_fuzz.c	Wed Aug 17 07:25:50 2016	(r304268)
+++ projects/fix-libarchive-tests-after-r304075/contrib/libarchive/libarchive/test/test_fuzz.c	Wed Aug 17 07:30:23 2016	(r304269)
@@ -141,7 +141,7 @@ test_fuzz(const struct files *filesets)
 		srand((unsigned)time(NULL));
 
 		for (i = 0; i < 1000; ++i) {
-			FILE *f;
+			FILE *f = NULL;
 			int j, numbytes, trycnt;
 
 			/* Fuzz < 1% of the bytes in the archive. */
@@ -169,6 +169,7 @@ test_fuzz(const struct files *filesets)
 				Sleep(100);
 #endif
 			}
+			assert(f != NULL);
 			assertEqualInt((size_t)size, fwrite(image, 1, (size_t)size, f));
 			fclose(f);
 


More information about the svn-src-projects mailing list