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
MFC after:	1 week
This commit is contained in:
Don Lewis 2016-05-13 00:26:14 +00:00
parent 5d29410d37
commit 4238b561f0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=299581

View File

@ -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;