use strlcpy instead of strncpy or bcopy to copy the interface name.
This commit is contained in:
parent
8c71201d08
commit
f6c67772ca
11
sys/net/if.c
11
sys/net/if.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if.c,v 1.171 2006/10/22 13:25:54 pooka Exp $ */
|
||||
/* $NetBSD: if.c,v 1.172 2006/10/22 18:24:02 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
|
||||
@ -97,7 +97,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.171 2006/10/22 13:25:54 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.172 2006/10/22 18:24:02 christos Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
|
||||
@ -886,9 +886,8 @@ if_clone_list(struct if_clonereq *ifcr)
|
||||
|
||||
for (ifc = LIST_FIRST(&if_cloners); ifc != NULL && count != 0;
|
||||
ifc = LIST_NEXT(ifc, ifc_list), count--, dst += IFNAMSIZ) {
|
||||
strncpy(outbuf, ifc->ifc_name, IFNAMSIZ);
|
||||
outbuf[IFNAMSIZ - 1] = '\0'; /* sanity */
|
||||
error = copyout(outbuf, dst, IFNAMSIZ);
|
||||
(void)strlcpy(outbuf, ifc->ifc_name, sizeof(outbuf));
|
||||
error = copyout(outbuf, dst, sizeof(outbuf));
|
||||
if (error)
|
||||
break;
|
||||
}
|
||||
@ -1611,7 +1610,7 @@ ifconf(u_long cmd __unused, caddr_t data)
|
||||
sign = 1;
|
||||
}
|
||||
IFNET_FOREACH(ifp) {
|
||||
bcopy(ifp->if_xname, ifr.ifr_name, IFNAMSIZ);
|
||||
(void)strlcpy(ifr.ifr_name, ifp->if_xname, sizeof(ifr_if_name));
|
||||
if ((ifa = TAILQ_FIRST(&ifp->if_addrlist)) == 0) {
|
||||
memset(&ifr.ifr_addr, 0, sizeof(ifr.ifr_addr));
|
||||
if (ifrp != NULL && space >= sz) {
|
||||
|
Loading…
Reference in New Issue
Block a user