Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 May 2016 06:27:59 +0000 (UTC)
From:      Don Lewis <truckman@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r300270 - stable/10/usr.sbin/edquota
Message-ID:  <201605200627.u4K6Rxkh081782@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: truckman
Date: Fri May 20 06:27:58 2016
New Revision: 300270
URL: https://svnweb.freebsd.org/changeset/base/300270

Log:
  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

Modified:
  stable/10/usr.sbin/edquota/edquota.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/edquota/edquota.c
==============================================================================
--- stable/10/usr.sbin/edquota/edquota.c	Fri May 20 06:24:16 2016	(r300269)
+++ stable/10/usr.sbin/edquota/edquota.c	Fri May 20 06:27:58 2016	(r300270)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605200627.u4K6Rxkh081782>