From owner-svn-src-stable-11@freebsd.org Fri Apr 28 14:48:30 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E7B8D53AF4; Fri, 28 Apr 2017 14:48:30 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D90BF6E; Fri, 28 Apr 2017 14:48:30 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3SEmTbL000181; Fri, 28 Apr 2017 14:48:29 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3SEmT0N000180; Fri, 28 Apr 2017 14:48:29 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201704281448.v3SEmT0N000180@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 28 Apr 2017 14:48:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317556 - stable/11/sbin/mount X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Apr 2017 14:48:30 -0000 Author: asomers Date: Fri Apr 28 14:48:29 2017 New Revision: 317556 URL: https://svnweb.freebsd.org/changeset/base/317556 Log: MFC r316611: sbin/mount: strcpy -> strlcpy Reported by: Coverity CID: 1011173, 1011174 Sponsored by: Spectra Logic Corp Modified: stable/11/sbin/mount/mount.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/mount/mount.c ============================================================================== --- stable/11/sbin/mount/mount.c Fri Apr 28 14:45:03 2017 (r317555) +++ stable/11/sbin/mount/mount.c Fri Apr 28 14:48:29 2017 (r317556) @@ -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)); @@ -905,8 +905,9 @@ putfsent(struct statfs *ent) if (strncmp(ent->f_mntfromname, "", 7) == 0 || strncmp(ent->f_mntfromname, "", 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);