diff options
author | truckman <truckman@FreeBSD.org> | 2016-05-13 00:02:03 +0000 |
---|---|---|
committer | truckman <truckman@FreeBSD.org> | 2016-05-13 00:02:03 +0000 |
commit | 7ff462184f1e271bee176990dc6683f0fce82071 (patch) | |
tree | f8a96ab9ba6a5e113f61c6e7921d5bdd7940fe26 | |
parent | 0e623bbd6b2c48e987a54ea633a8389ec01e6c70 (diff) | |
download | FreeBSD-src-7ff462184f1e271bee176990dc6683f0fce82071.zip FreeBSD-src-7ff462184f1e271bee176990dc6683f0fce82071.tar.gz |
Use strlcpy() instead of strncpy() to ensure that qup->fsname is NUL
terminated. Don't bother checking for truncation since the subsequent
quota_read() should detect that and fail.
Reported by: Coverity
CID: 1009980
MFC after: 1 week
-rw-r--r-- | usr.sbin/edquota/edquota.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.sbin/edquota/edquota.c b/usr.sbin/edquota/edquota.c index 0cd117f..6a6c194 100644 --- a/usr.sbin/edquota/edquota.c +++ b/usr.sbin/edquota/edquota.c @@ -390,7 +390,7 @@ getprivs(long id, int quotatype, char *fspath) if ((qup = (struct quotause *)calloc(1, sizeof(*qup))) == NULL) errx(2, "out of memory"); qup->qf = qf; - strncpy(qup->fsname, fs->fs_file, sizeof(qup->fsname)); + strlcpy(qup->fsname, fs->fs_file, sizeof(qup->fsname)); if (quota_read(qf, &qup->dqblk, id) == -1) { warn("cannot read quotas on %s", fs->fs_file); freeprivs(qup); |