svn commit: r301149 - stable/10/bin/setfacl

Don Lewis truckman at FreeBSD.org
Wed Jun 1 17:35:04 UTC 2016


Author: truckman
Date: Wed Jun  1 17:35:03 2016
New Revision: 301149
URL: https://svnweb.freebsd.org/changeset/base/301149

Log:
  MFC r300649
  
  Fix Coverity CID 1019054 (String not null terminated) in setfacl.
  
  Increase the size of buf[] by one to allow room for a NUL character
  at the end.
  
  Reported by:	Coverity
  CID:		1019054

Modified:
  stable/10/bin/setfacl/file.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/bin/setfacl/file.c
==============================================================================
--- stable/10/bin/setfacl/file.c	Wed Jun  1 17:33:02 2016	(r301148)
+++ stable/10/bin/setfacl/file.c	Wed Jun  1 17:35:03 2016	(r301149)
@@ -43,7 +43,7 @@ acl_t
 get_acl_from_file(const char *filename)
 {
 	FILE *file;
-	char buf[BUFSIZ];
+	char buf[BUFSIZ+1];
 
 	if (filename == NULL)
 		err(1, "(null) filename in get_acl_from_file()");
@@ -61,7 +61,7 @@ get_acl_from_file(const char *filename)
 			err(1, "fopen() %s failed", filename);
 	}
 
-	fread(buf, sizeof(buf), (size_t)1, file);
+	fread(buf, sizeof(buf) - 1, (size_t)1, file);
 	if (ferror(file) != 0) {
 		fclose(file);
 		err(1, "error reading from %s", filename);


More information about the svn-src-all mailing list