From owner-svn-src-head@freebsd.org Tue Dec 5 07:11:57 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 57C70DF9031; Tue, 5 Dec 2017 07:11:57 +0000 (UTC) (envelope-from delphij@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 245B56E26E; Tue, 5 Dec 2017 07:11:57 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vB57BuLc056801; Tue, 5 Dec 2017 07:11:56 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vB57BuGx056800; Tue, 5 Dec 2017 07:11:56 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201712050711.vB57BuGx056800@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 5 Dec 2017 07:11:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326561 - head/usr.bin/su X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/usr.bin/su X-SVN-Commit-Revision: 326561 X-SVN-Commit-Repository: base 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.25 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, 05 Dec 2017 07:11:57 -0000 Author: delphij Date: Tue Dec 5 07:11:56 2017 New Revision: 326561 URL: https://svnweb.freebsd.org/changeset/base/326561 Log: Use strlcpy(). MFC after: 2 weeks Modified: head/usr.bin/su/su.c Modified: head/usr.bin/su/su.c ============================================================================== --- head/usr.bin/su/su.c Tue Dec 5 07:01:10 2017 (r326560) +++ head/usr.bin/su/su.c Tue Dec 5 07:11:56 2017 (r326561) @@ -277,9 +277,9 @@ main(int argc, char *argv[]) if (asme) { if (pwd->pw_shell != NULL && *pwd->pw_shell != '\0') { /* must copy - pwd memory is recycled */ - shell = strncpy(shellbuf, pwd->pw_shell, + strlcpy(shellbuf, pwd->pw_shell, sizeof(shellbuf)); - shellbuf[sizeof(shellbuf) - 1] = '\0'; + shell = shellbuf; } else { shell = _PATH_BSHELL;