Date: Wed, 20 Dec 2017 07:55:47 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327021 - stable/11/usr.bin/su Message-ID: <201712200755.vBK7tlpg095718@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712200755.vBK7tlpg095718>