Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Dec 2017 07:11:56 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r326561 - head/usr.bin/su
Message-ID:  <201712050711.vB57BuGx056800@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712050711.vB57BuGx056800>