svn commit: r299385 - head/usr.bin/sdiff

Conrad E. Meyer cem at FreeBSD.org
Tue May 10 20:09:41 UTC 2016


Author: cem
Date: Tue May 10 20:09:40 2016
New Revision: 299385
URL: https://svnweb.freebsd.org/changeset/base/299385

Log:
  sdiff(1): Fix potential NULL deref in cleanup path
  
  In the presence of the --diff-pid argument, it is possible for 'diffpipe' to be
  NULL.  Only fclose() it if it was initialized.
  
  Reported by:	Coverity
  CID:		1355183
  Sponsored by:	EMC / Isilon Storage Division

Modified:
  head/usr.bin/sdiff/sdiff.c

Modified: head/usr.bin/sdiff/sdiff.c
==============================================================================
--- head/usr.bin/sdiff/sdiff.c	Tue May 10 20:02:03 2016	(r299384)
+++ head/usr.bin/sdiff/sdiff.c	Tue May 10 20:09:40 2016	(r299385)
@@ -430,7 +430,8 @@ main(int argc, char **argv)
 		/* Close open files and pipe, delete temps */
 		fclose(file1);
 		fclose(file2);
-		fclose(diffpipe);
+		if (diffpipe != NULL)
+			fclose(diffpipe);
 		if (tmp1)
 			if (unlink(tmp1))
 				warn("Error deleting %s.", tmp1);


More information about the svn-src-head mailing list