From owner-svn-src-all@freebsd.org Tue May 30 15:18:23 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 C896CB7F366; Tue, 30 May 2017 15:18:23 +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 965A765C26; Tue, 30 May 2017 15:18:23 +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 v4UFIMbW075396; Tue, 30 May 2017 15:18:22 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4UFIMce075394; Tue, 30 May 2017 15:18:22 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201705301518.v4UFIMce075394@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 15:18:22 +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: r319217 - in stable/11: usr.bin/mkuzip usr.sbin/pw X-SVN-Group: stable-11 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 15:18:23 -0000 Author: asomers Date: Tue May 30 15:18:22 2017 New Revision: 319217 URL: https://svnweb.freebsd.org/changeset/base/319217 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/11/usr.bin/mkuzip/mkuzip.c stable/11/usr.sbin/pw/pw_user.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/mkuzip/mkuzip.c ============================================================================== --- stable/11/usr.bin/mkuzip/mkuzip.c Tue May 30 14:50:28 2017 (r319216) +++ stable/11/usr.bin/mkuzip/mkuzip.c Tue May 30 15:18:22 2017 (r319217) @@ -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/11/usr.sbin/pw/pw_user.c ============================================================================== --- stable/11/usr.sbin/pw/pw_user.c Tue May 30 14:50:28 2017 (r319216) +++ stable/11/usr.sbin/pw/pw_user.c Tue May 30 15:18:22 2017 (r319217) @@ -33,6 +33,7 @@ static const char rcsid[] = #include #include +#include #include #include #include @@ -490,6 +491,7 @@ pw_pwcrypt(char *password) char salt[SALTSIZE + 1]; char *cryptpw; static char buf[256]; + size_t pwlen; /* * Calculate a salt value @@ -501,7 +503,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 *