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
This commit is contained in:
Don Lewis 2016-05-20 06:35:14 +00:00
parent 7fab3432b6
commit 9984c2ebf9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/stable/10/; revision=300272

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;