From 7b063349154ddce7110099cbe1a74c0fa86b4dfe Mon Sep 17 00:00:00 2001 From: Don Lewis Date: Sun, 15 May 2016 21:45:04 +0000 Subject: [PATCH] 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 --- 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 eb80dbe31495..65356a2184b7 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;