From owner-svn-src-all@freebsd.org Thu Apr 13 23:22:19 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 576F0D3DA14; Thu, 13 Apr 2017 23:22:19 +0000 (UTC) (envelope-from cem@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 2995DFE7; Thu, 13 Apr 2017 23:22:19 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3DNMIHk095363; Thu, 13 Apr 2017 23:22:18 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3DNMIWh095362; Thu, 13 Apr 2017 23:22:18 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201704132322.v3DNMIWh095362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 13 Apr 2017 23:22:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316797 - head/usr.bin/banner X-SVN-Group: head 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: Thu, 13 Apr 2017 23:22:19 -0000 Author: cem Date: Thu Apr 13 23:22:18 2017 New Revision: 316797 URL: https://svnweb.freebsd.org/changeset/base/316797 Log: banner(6): Squash a harmless coverity warning The destination buffer is sized as the sum of program argument lengths, so it has plenty of room for *argv. Appease Coverity by using strlcpy instead of strcpy. Similar to a nearby cleanup performed in r316500. No functional change. Reported by: Coverity (CWE-120) CID: 1006703 Sponsored by: Dell EMC Isilon Modified: head/usr.bin/banner/banner.c Modified: head/usr.bin/banner/banner.c ============================================================================== --- head/usr.bin/banner/banner.c Thu Apr 13 23:00:26 2017 (r316796) +++ head/usr.bin/banner/banner.c Thu Apr 13 23:22:18 2017 (r316797) @@ -1062,7 +1062,7 @@ main(int argc, char *argv[]) j += strlen(argv[i]) + 1; if ((message = malloc((size_t)j)) == NULL) err(1, "malloc"); - strcpy(message, *argv); + strlcpy(message, *argv, j); while (*++argv) { strlcat(message, " ", j); strlcat(message, *argv, j);