summaryrefslogtreecommitdiffstats
path: root/usr.sbin/edquota
diff options
context:
space:
mode:
authortruckman <truckman@FreeBSD.org>2016-05-20 06:27:58 +0000
committertruckman <truckman@FreeBSD.org>2016-05-20 06:27:58 +0000
commit5e92b42b1a96a917ed2c4a062277670eb485e244 (patch)
tree31a0c88e7c35c9e271d3b141630228a29577406c /usr.sbin/edquota
parenteb1ff2addcd8450cc91c4d23c26ae43f7f66bb92 (diff)
downloadFreeBSD-src-5e92b42b1a96a917ed2c4a062277670eb485e244.zip
FreeBSD-src-5e92b42b1a96a917ed2c4a062277670eb485e244.tar.gz
MFC r299579
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
Diffstat (limited to 'usr.sbin/edquota')
-rw-r--r--usr.sbin/edquota/edquota.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.sbin/edquota/edquota.c b/usr.sbin/edquota/edquota.c
index a92a3c8..c3a698c 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);
OpenPOWER on IntegriCloud