From 95838651f8e0162ed6cd6e76a2346b4537d92256 Mon Sep 17 00:00:00 2001 From: truckman Date: Fri, 20 May 2016 06:27:58 +0000 Subject: [PATCH] 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 git-svn-id: svn://svn.freebsd.org/base/stable/10@300270 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- usr.sbin/edquota/edquota.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/edquota/edquota.c b/usr.sbin/edquota/edquota.c index a92a3c8f9..c3a698c91 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); -- 2.45.0