From 9984c2ebf94ed71480da1e6a247742f981f31605 Mon Sep 17 00:00:00 2001 From: Don Lewis Date: Fri, 20 May 2016 06:35:14 +0000 Subject: [PATCH] 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 --- lib/libutil/quotafile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libutil/quotafile.c b/lib/libutil/quotafile.c index 6b5a44d9cdf7..27444c2e31a5 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;