svn commit: r326561 - head/usr.bin/su
Xin LI
delphij at FreeBSD.org
Tue Dec 5 07:11:57 UTC 2017
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;
More information about the svn-src-head
mailing list