summaryrefslogtreecommitdiffstats
path: root/bin/setfacl
diff options
context:
space:
mode:
authortruckman <truckman@FreeBSD.org>2016-06-01 17:35:03 +0000
committertruckman <truckman@FreeBSD.org>2016-06-01 17:35:03 +0000
commit281ac18e42f4f5ca01787dd3b30e1af7c09b8f80 (patch)
treef496187e328ac4a37747588bc7541a684d243062 /bin/setfacl
parentefd2996ff9ab633d8be09fa755ee1b021937fede (diff)
downloadFreeBSD-src-281ac18e42f4f5ca01787dd3b30e1af7c09b8f80.zip
FreeBSD-src-281ac18e42f4f5ca01787dd3b30e1af7c09b8f80.tar.gz
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
Diffstat (limited to 'bin/setfacl')
-rw-r--r--bin/setfacl/file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/setfacl/file.c b/bin/setfacl/file.c
index c44f398..e5e19a2 100644
--- a/bin/setfacl/file.c
+++ b/bin/setfacl/file.c
@@ -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);
OpenPOWER on IntegriCloud