Author: truckman
Date: Fri May 13 00:02:03 2016
New Revision: 299579
URL: https://svnweb.freebsd.org/changeset/base/299579
Log:
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
Modified:
head/usr.sbin/edquota/edquota.c
Modified: head/usr.sbin/edquota/edquota.c
==============================================================================
--- head/usr.sbin/edquota/edquota.c Thu May 12 23:37:58 2016
(r299578)
+++ head/usr.sbin/edquota/edquota.c Fri May 13 00:02:03 2016
(r299579)
@@ -390,7 +390,7 @@ getprivs(long id, int quotatype, char *f
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);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"