From 6e1e70b99ae7047ff9688b7d8df2298000bc4810 Mon Sep 17 00:00:00 2001 From: truckman Date: Fri, 20 May 2016 06:56:43 +0000 Subject: [PATCH] MFC 299866 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 git-svn-id: svn://svn.freebsd.org/base/stable/10@300279 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- usr.sbin/lmcconfig/lmcconfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/lmcconfig/lmcconfig.c b/usr.sbin/lmcconfig/lmcconfig.c index 7fbc2168e..95ed87a34 100644 --- a/usr.sbin/lmcconfig/lmcconfig.c +++ b/usr.sbin/lmcconfig/lmcconfig.c @@ -222,7 +222,7 @@ call_driver(unsigned long cmd, struct iohdr *iohdr) { 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; -- 2.45.0