svn commit: r327021 - stable/11/usr.bin/su

Xin LI delphij at FreeBSD.org
Wed Dec 20 07:55:48 UTC 2017


Author: delphij
Date: Wed Dec 20 07:55:47 2017
New Revision: 327021
URL: https://svnweb.freebsd.org/changeset/base/327021

Log:
  MFC r326561: Use strlcpy().

Modified:
  stable/11/usr.bin/su/su.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/su/su.c
==============================================================================
--- stable/11/usr.bin/su/su.c	Wed Dec 20 07:43:32 2017	(r327020)
+++ stable/11/usr.bin/su/su.c	Wed Dec 20 07:55:47 2017	(r327021)
@@ -275,9 +275,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;


More information about the svn-src-all mailing list