summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authortruckman <truckman@FreeBSD.org>2016-05-20 06:35:14 +0000
committertruckman <truckman@FreeBSD.org>2016-05-20 06:35:14 +0000
commitd47cdea4533b5c64c63e7f071aa11bc243289759 (patch)
tree665e546d0d094dc92f741b9e6de06a33900b5835 /lib
parent936d644d38ed48d52a4644db1dbca297a504170e (diff)
downloadFreeBSD-src-d47cdea4533b5c64c63e7f071aa11bc243289759.zip
FreeBSD-src-d47cdea4533b5c64c63e7f071aa11bc243289759.tar.gz
MFC r299581
Use strlcpy() instead of strncpy() to ensure that qf->fsname is NUL terminated. Don't bother checking for truncation since the subsequent stat() call should detect that and fail. Reported by: Coverity CID: 1018189
Diffstat (limited to 'lib')
-rw-r--r--lib/libutil/quotafile.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libutil/quotafile.c b/lib/libutil/quotafile.c
index 6b5a44d..27444c2 100644
--- a/lib/libutil/quotafile.c
+++ b/lib/libutil/quotafile.c
@@ -124,7 +124,7 @@ quota_open(struct fstab *fs, int quotatype, int openflags)
return (NULL);
qf->fd = -1;
qf->quotatype = quotatype;
- strncpy(qf->fsname, fs->fs_file, sizeof(qf->fsname));
+ strlcpy(qf->fsname, fs->fs_file, sizeof(qf->fsname));
if (stat(qf->fsname, &st) != 0)
goto error;
qf->dev = st.st_dev;
OpenPOWER on IntegriCloud