svn commit: r299866 - head/usr.sbin/lmcconfig

Don Lewis truckman at FreeBSD.org
Sun May 15 21:45:05 UTC 2016


Author: truckman
Date: Sun May 15 21:45:04 2016
New Revision: 299866
URL: https://svnweb.freebsd.org/changeset/base/299866

Log:
  Use strlcpy() instead of strncpy() when copying ifname to ensure
  that it is NUL terminated.  Additional NUL padding is not required
  for short names.
  
  Reported by:	Coverity
  CID:		974852
  MFC after:	1 week

Modified:
  head/usr.sbin/lmcconfig/lmcconfig.c

Modified: head/usr.sbin/lmcconfig/lmcconfig.c
==============================================================================
--- head/usr.sbin/lmcconfig/lmcconfig.c	Sun May 15 21:37:36 2016	(r299865)
+++ head/usr.sbin/lmcconfig/lmcconfig.c	Sun May 15 21:45:04 2016	(r299866)
@@ -222,7 +222,7 @@ call_driver(unsigned long cmd, struct io
 {
   int error = 0;
 
-  strncpy(iohdr->ifname, ifname, sizeof(iohdr->ifname));
+  strlcpy(iohdr->ifname, ifname, sizeof(iohdr->ifname));
   iohdr->cookie = NGM_LMC_COOKIE;
   iohdr->iohdr = iohdr;
 


More information about the svn-src-all mailing list