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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to