Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Apr 2017 15:39:41 +0000 (UTC)
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r316611 - head/sbin/mount
Message-ID:  <201704071539.v37Fdf63017737@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: asomers
Date: Fri Apr  7 15:39:41 2017
New Revision: 316611
URL: https://svnweb.freebsd.org/changeset/base/316611

Log:
  sbin/mount: strcpy -> strlcpy
  
  Reported by:	Coverity
  CID:		1011173, 1011174
  MFC after:	3 weeks
  Sponsored by:	Spectra Logic Corp

Modified:
  head/sbin/mount/mount.c

Modified: head/sbin/mount/mount.c
==============================================================================
--- head/sbin/mount/mount.c	Fri Apr  7 15:15:10 2017	(r316610)
+++ head/sbin/mount/mount.c	Fri Apr  7 15:39:41 2017	(r316611)
@@ -597,7 +597,7 @@ mountfs(const char *vfstype, const char 
 	append_arg(&mnt_argv, execname);
 	mangle(optbuf, &mnt_argv);
 	if (mountprog != NULL)
-		strcpy(execname, mountprog);
+		strlcpy(execname, mountprog, sizeof(execname));
 
 	append_arg(&mnt_argv, strdup(spec));
 	append_arg(&mnt_argv, strdup(name));
@@ -902,8 +902,9 @@ putfsent(struct statfs *ent)
 
 	if (strncmp(ent->f_mntfromname, "<below>", 7) == 0 ||
 	    strncmp(ent->f_mntfromname, "<above>", 7) == 0) {
-		strcpy(ent->f_mntfromname, (strnstr(ent->f_mntfromname, ":", 8)
-		    +1));
+		strlcpy(ent->f_mntfromname,
+		    (strnstr(ent->f_mntfromname, ":", 8) +1),
+		    sizeof(ent->f_mntfromname));
 	}
 
 	l = strlen(ent->f_mntfromname);



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