Author: delphij
Date: Thu Oct 29 16:45:06 2015
New Revision: 290146
URL: https://svnweb.freebsd.org/changeset/base/290146

Log:
  MFC r288960:
  
  Use strlcpy() when the string is expected to be nul-terminated.

Modified:
  stable/10/usr.sbin/watch/watch.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/watch/watch.c
==============================================================================
--- stable/10/usr.sbin/watch/watch.c    Thu Oct 29 16:34:55 2015        
(r290145)
+++ stable/10/usr.sbin/watch/watch.c    Thu Oct 29 16:45:06 2015        
(r290146)
@@ -247,7 +247,7 @@ set_dev(const char *name)
        if ((sb.st_mode & S_IFMT) != S_IFCHR)
                fatal(EX_DATAERR, "must be a character device");
 
-       strncpy(dev_name, buf, DEV_NAME_LEN);
+       strlcpy(dev_name, buf, sizeof(dev_name));
 
        attach_snp();
 }
@@ -340,7 +340,7 @@ main(int ac, char *av[])
                else
                        fatal(EX_DATAERR, "no device name given");
        } else
-               strncpy(dev_name, *av, DEV_NAME_LEN);
+               strlcpy(dev_name, *av, sizeof(dev_name));
 
        set_dev(dev_name);
 
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to