From owner-svn-src-all@freebsd.org Tue May 30 22:48:18 2017 Return-Path: Delivered-To: svn-src-all@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 50549BF0426; Tue, 30 May 2017 22:48:18 +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 1FA977E82F; Tue, 30 May 2017 22:48:18 +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 v4UMmHsM076146; Tue, 30 May 2017 22:48:17 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4UMmHKC076144; Tue, 30 May 2017 22:48:17 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201705302248.v4UMmHKC076144@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 30 May 2017 22:48:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r319267 - in stable/10: usr.bin/mkuzip usr.sbin/pw X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 May 2017 22:48:18 -0000 Author: asomers Date: Tue May 30 22:48:17 2017 New Revision: 319267 URL: https://svnweb.freebsd.org/changeset/base/319267 Log: MFC r318141, r318143-r318144 r318141: strcpy => strlcpy Reported by: Coverity CID: 1352771 Sponsored by: Spectra Logic Corp r318143: strcpy => strlcpy Reported by: Coverity CID: 1006715 Sponsored by: Spectra Logic Corp r318144: Don't depend on assert(3) getting evaluated Reported by: imp X-MFC-With: 318141, 318143 Sponsored by: Spectra Logic Corp Modified: stable/10/usr.bin/mkuzip/mkuzip.c stable/10/usr.sbin/pw/pw_user.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/mkuzip/mkuzip.c ============================================================================== --- stable/10/usr.bin/mkuzip/mkuzip.c Tue May 30 22:46:00 2017 (r319266) +++ stable/10/usr.bin/mkuzip/mkuzip.c Tue May 30 22:48:17 2017 (r319267) @@ -108,7 +108,7 @@ int main(int argc, char **argv) struct mkuz_conveyor *cvp; void *c_ctx; struct mkuz_blk_info *chit; - size_t ncpusz, ncpu; + size_t ncpusz, ncpu, magiclen; double st, et; st = getdtime(); @@ -192,7 +192,8 @@ int main(int argc, char **argv) /* Not reached */ } - strcpy(hdr.magic, cfs.handler->magic); + magiclen = strlcpy(hdr.magic, cfs.handler->magic, sizeof(hdr.magic)); + assert(magiclen < sizeof(hdr.magic)); if (cfs.en_dedup != 0) { hdr.magic[CLOOP_OFS_VERSN] = CLOOP_MAJVER_3; Modified: stable/10/usr.sbin/pw/pw_user.c ============================================================================== --- stable/10/usr.sbin/pw/pw_user.c Tue May 30 22:46:00 2017 (r319266) +++ stable/10/usr.sbin/pw/pw_user.c Tue May 30 22:48:17 2017 (r319267) @@ -35,6 +35,7 @@ static const char rcsid[] = #include #include +#include #include #include #include @@ -492,6 +493,7 @@ pw_pwcrypt(char *password) char salt[SALTSIZE + 1]; char *cryptpw; static char buf[256]; + size_t pwlen; /* * Calculate a salt value @@ -503,7 +505,9 @@ pw_pwcrypt(char *password) cryptpw = crypt(password, salt); if (cryptpw == NULL) errx(EX_CONFIG, "crypt(3) failure"); - return strcpy(buf, cryptpw); + pwlen = strlcpy(buf, cryptpw, sizeof(buf)); + assert(pwlen < sizeof(buf)); + return (buf); } static char *