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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to