From owner-svn-src-stable-10@freebsd.org Tue May 30 21:58:54 2017 Return-Path: Delivered-To: svn-src-stable-10@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 8E87EBEF100; Tue, 30 May 2017 21:58:54 +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 5E1487C264; Tue, 30 May 2017 21:58:54 +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 v4ULwrv8055514; Tue, 30 May 2017 21:58:53 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4ULwrMB055511; Tue, 30 May 2017 21:58:53 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201705302158.v4ULwrMB055511@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 21:58:53 +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: r319256 - in stable/10/usr.bin: banner limits rpcinfo X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 May 2017 21:58:54 -0000 Author: asomers Date: Tue May 30 21:58:53 2017 New Revision: 319256 URL: https://svnweb.freebsd.org/changeset/base/319256 Log: MFC r316500 (except the part to usr.bin/fortune) strcpy => strlcpy, strcat => strlcat Reported by: Coverity CID: 1006703 978863 1006745 1347163 Reviewed by: cem Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D10192 Modified: stable/10/usr.bin/banner/banner.c stable/10/usr.bin/limits/limits.c stable/10/usr.bin/rpcinfo/rpcinfo.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/banner/banner.c ============================================================================== --- stable/10/usr.bin/banner/banner.c Tue May 30 21:57:25 2017 (r319255) +++ stable/10/usr.bin/banner/banner.c Tue May 30 21:58:53 2017 (r319256) @@ -1064,8 +1064,8 @@ main(int argc, char *argv[]) err(1, "malloc"); strcpy(message, *argv); while (*++argv) { - strcat(message, " "); - strcat(message, *argv); + strlcat(message, " ", j); + strlcat(message, *argv, j); } nchars = strlen(message); } else { Modified: stable/10/usr.bin/limits/limits.c ============================================================================== --- stable/10/usr.bin/limits/limits.c Tue May 30 21:57:25 2017 (r319255) +++ stable/10/usr.bin/limits/limits.c Tue May 30 21:58:53 2017 (r319256) @@ -549,7 +549,7 @@ print_limit(rlim_t limit, unsigned divisor, const char char numbr[64]; if (limit == RLIM_INFINITY) - strcpy(numbr, inf); + strlcpy(numbr, inf, sizeof(numbr)); else sprintf(numbr, "%jd", (intmax_t)((limit + divisor/2) / divisor)); printf(pfx, which, numbr); Modified: stable/10/usr.bin/rpcinfo/rpcinfo.c ============================================================================== --- stable/10/usr.bin/rpcinfo/rpcinfo.c Tue May 30 21:57:25 2017 (r319255) +++ stable/10/usr.bin/rpcinfo/rpcinfo.c Tue May 30 21:58:53 2017 (r319256) @@ -854,9 +854,9 @@ failed: printf("%-10s", buf); buf[0] = '\0'; for (nl = rs->nlist; nl; nl = nl->next) { - strcat(buf, nl->netid); + strlcat(buf, nl->netid, sizeof(buf)); if (nl->next) - strcat(buf, ","); + strlcat(buf, ",", sizeof(buf)); } printf("%-32s", buf); rpc = getrpcbynumber(rs->prog);