diff options
author | truckman <truckman@FreeBSD.org> | 2016-05-13 00:26:14 +0000 |
---|---|---|
committer | truckman <truckman@FreeBSD.org> | 2016-05-13 00:26:14 +0000 |
commit | 61eb4d5d8afa53a504d7065b957da20e85fc4878 (patch) | |
tree | a52e785831b3911a38ea3afee000a4c8070d529a /lib/libutil | |
parent | 4e9e03d38e852ee3ab1911310614b99fa17cc82f (diff) | |
download | FreeBSD-src-61eb4d5d8afa53a504d7065b957da20e85fc4878.zip FreeBSD-src-61eb4d5d8afa53a504d7065b957da20e85fc4878.tar.gz |
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
Diffstat (limited to 'lib/libutil')
-rw-r--r-- | lib/libutil/quotafile.c | 2 |
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; |