Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 May 2016 21:45:04 +0000 (UTC)
From:      Don Lewis <truckman@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r299866 - head/usr.sbin/lmcconfig
Message-ID:  <201605152145.u4FLj4mW099423@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605152145.u4FLj4mW099423>