Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 May 2017 22:36:24 +0000 (UTC)
From:      Alan Somers <asomers@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: r319261 - stable/10/sbin/mount
Message-ID:  <201705302236.v4UMaOHF071763@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: asomers
Date: Tue May 30 22:36:24 2017
New Revision: 319261
URL: https://svnweb.freebsd.org/changeset/base/319261

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

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

Modified: stable/10/sbin/mount/mount.c
==============================================================================
--- stable/10/sbin/mount/mount.c	Tue May 30 22:35:36 2017	(r319260)
+++ stable/10/sbin/mount/mount.c	Tue May 30 22:36:24 2017	(r319261)
@@ -597,7 +597,7 @@ mountfs(const char *vfstype, const char *spec, const c
 	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));
@@ -905,8 +905,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?201705302236.v4UMaOHF071763>