Author: truckman
Date: Fri May 13 00:17:57 2016
New Revision: 299580
URL: https://svnweb.freebsd.org/changeset/base/299580

Log:
  Use strlcpy() instead of strncpy() to ensure that ret->name is
  NUL terminated.  The source and destination buffers are the same
  size and the source *should* be NUL terminated, but be paranoid.
  
  Reported by:  Coverity
  CID:          1011274
  MFC after:    1 week

Modified:
  head/usr.sbin/timed/timed/master.c

Modified: head/usr.sbin/timed/timed/master.c
==============================================================================
--- head/usr.sbin/timed/timed/master.c  Fri May 13 00:02:03 2016        
(r299579)
+++ head/usr.sbin/timed/timed/master.c  Fri May 13 00:17:57 2016        
(r299580)
@@ -623,7 +623,7 @@ addmach(char *name, struct sockaddr_in *
                }
                ret->addr = *addr;
                ret->ntp = ntp;
-               (void)strncpy(ret->name, name, sizeof(ret->name));
+               (void)strlcpy(ret->name, name, sizeof(ret->name));
                ret->good = good_host_name(name);
                ret->l_fwd = &self;
                ret->l_bak = self.l_bak;
_______________________________________________
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