Date: Fri, 13 May 2016 00:26:14 +0000 (UTC) From: Don Lewis <truckman@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r299581 - head/lib/libutil Message-ID: <201605130026.u4D0QEcW016710@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: truckman Date: Fri May 13 00:26:14 2016 New Revision: 299581 URL: https://svnweb.freebsd.org/changeset/base/299581 Log: Use strlcpy() instead of strncpy() to ensure that qf->fsname is NUL terminated. Don't bother checking for truncation since the subsequent stat() call should detect that and fail. Reported by: Coverity CID: 1018189 MFC after: 1 week Modified: head/lib/libutil/quotafile.c Modified: head/lib/libutil/quotafile.c ============================================================================== --- head/lib/libutil/quotafile.c Fri May 13 00:17:57 2016 (r299580) +++ head/lib/libutil/quotafile.c Fri May 13 00:26:14 2016 (r299581) @@ -124,7 +124,7 @@ quota_open(struct fstab *fs, int quotaty return (NULL); qf->fd = -1; qf->quotatype = quotatype; - strncpy(qf->fsname, fs->fs_file, sizeof(qf->fsname)); + strlcpy(qf->fsname, fs->fs_file, sizeof(qf->fsname)); if (stat(qf->fsname, &st) != 0) goto error; qf->dev = st.st_dev;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605130026.u4D0QEcW016710>