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
This commit is contained in:
Don Lewis 2016-05-15 21:45:04 +00:00
parent 1ef3d54d20
commit 7b06334915

View File

@ -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;