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

Reply via email to