From owner-svn-src-head@freebsd.org Tue Apr 4 19:46:25 2017 Return-Path: Delivered-To: svn-src-head@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 4FEF7D2EE30; Tue, 4 Apr 2017 19:46:25 +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 061731F60; Tue, 4 Apr 2017 19:46:24 +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 v34JkOK1045214; Tue, 4 Apr 2017 19:46:24 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v34JkNQq045210; Tue, 4 Apr 2017 19:46:23 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201704041946.v34JkNQq045210@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 4 Apr 2017 19:46:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316500 - in head/usr.bin: banner fortune/strfile limits rpcinfo X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Apr 2017 19:46:25 -0000 Author: asomers Date: Tue Apr 4 19:46:23 2017 New Revision: 316500 URL: https://svnweb.freebsd.org/changeset/base/316500 Log: strcpy => strlcpy, strcat => strlcat Reported by: Coverity CID: 1006703 978863 1006745 1347163 Reviewed by: cem MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D10192 Modified: head/usr.bin/banner/banner.c head/usr.bin/fortune/strfile/strfile.c head/usr.bin/limits/limits.c head/usr.bin/rpcinfo/rpcinfo.c Modified: head/usr.bin/banner/banner.c ============================================================================== --- head/usr.bin/banner/banner.c Tue Apr 4 18:01:35 2017 (r316499) +++ head/usr.bin/banner/banner.c Tue Apr 4 19:46:23 2017 (r316500) @@ -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: head/usr.bin/fortune/strfile/strfile.c ============================================================================== --- head/usr.bin/fortune/strfile/strfile.c Tue Apr 4 18:01:35 2017 (r316499) +++ head/usr.bin/fortune/strfile/strfile.c Tue Apr 4 19:46:23 2017 (r316500) @@ -303,8 +303,8 @@ getargs(int argc, char **argv) usage(); } if (*Outfile == '\0') { - strcpy(Outfile, Infile); - strcat(Outfile, ".dat"); + strlcpy(Outfile, Infile, sizeof(Outfile)); + strlcat(Outfile, ".dat", sizeof(Outfile)); } } Modified: head/usr.bin/limits/limits.c ============================================================================== --- head/usr.bin/limits/limits.c Tue Apr 4 18:01:35 2017 (r316499) +++ head/usr.bin/limits/limits.c Tue Apr 4 19:46:23 2017 (r316500) @@ -561,7 +561,7 @@ print_limit(rlim_t limit, unsigned divis 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: head/usr.bin/rpcinfo/rpcinfo.c ============================================================================== --- head/usr.bin/rpcinfo/rpcinfo.c Tue Apr 4 18:01:35 2017 (r316499) +++ head/usr.bin/rpcinfo/rpcinfo.c Tue Apr 4 19:46:23 2017 (r316500) @@ -856,9 +856,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);