more strlcpy. from openbsd via kame

This commit is contained in:
itojun 2002-05-29 22:23:06 +00:00
parent d2b4e689bf
commit 1675bb6f17

View File

@ -1,5 +1,5 @@
/* $NetBSD: ndp.c,v 1.19 2002/05/29 08:04:40 itojun Exp $ */
/* $KAME: ndp.c,v 1.86 2002/05/26 01:16:10 itojun Exp $ */
/* $NetBSD: ndp.c,v 1.20 2002/05/29 22:23:06 itojun Exp $ */
/* $KAME: ndp.c,v 1.89 2002/05/29 22:21:46 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
@ -792,9 +792,8 @@ ether_str(sdl)
if (getnameinfo((struct sockaddr *)sdl, sdl->sdl_len,
hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0)
snprintf(hbuf, sizeof(hbuf), "<invalid>");
} else {
} else
snprintf(hbuf, sizeof(hbuf), "(incomplete)");
}
return(hbuf);
}
@ -922,7 +921,7 @@ ifinfo(argc, argv)
/* NOTREACHED */
}
bzero(&nd, sizeof(nd));
strncpy(nd.ifname, ifname, sizeof(nd.ifname));
strlcpy(nd.ifname, ifname, sizeof(nd.ifname));
if (ioctl(s, SIOCGIFINFO_IN6, (caddr_t)&nd) < 0) {
err(1, "ioctl(SIOCGIFINFO_IN6)");
/* NOTREACHED */
@ -1082,7 +1081,7 @@ rtrlist()
/* NOTREACHED */
}
bzero(&dr, sizeof(dr));
strcpy(dr.ifname, "lo0"); /* dummy */
strlcpy(dr.ifname, "lo0", sizeof(dr.ifname)); /* dummy */
if (ioctl(s, SIOCGDRLST_IN6, (caddr_t)&dr) < 0) {
err(1, "ioctl(SIOCGDRLST_IN6)");
/* NOTREACHED */
@ -1241,7 +1240,7 @@ plist()
/* NOTREACHED */
}
bzero(&pr, sizeof(pr));
strcpy(pr.ifname, "lo0"); /* dummy */
strlcpy(pr.ifname, "lo0", sizeof(pr.ifname)); /* dummy */
if (ioctl(s, SIOCGPRLST_IN6, (caddr_t)&pr) < 0) {
err(1, "ioctl(SIOCGPRLST_IN6)");
/* NOTREACHED */
@ -1410,7 +1409,7 @@ pfx_flush()
if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
err(1, "socket");
strcpy(dummyif, "lo0"); /* dummy */
strlcpy(dummyif, "lo0", sizeof(dummyif)); /* dummy */
if (ioctl(s, SIOCSPFXFLUSH_IN6, (caddr_t)&dummyif) < 0)
err(1, "ioctl(SIOCSPFXFLUSH_IN6)");
}
@ -1423,7 +1422,7 @@ rtr_flush()
if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
err(1, "socket");
strcpy(dummyif, "lo0"); /* dummy */
strlcpy(dummyif, "lo0", sizeof(dummyif)); /* dummy */
if (ioctl(s, SIOCSRTRFLUSH_IN6, (caddr_t)&dummyif) < 0)
err(1, "ioctl(SIOCSRTRFLUSH_IN6)");
@ -1438,7 +1437,7 @@ harmonize_rtr()
if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
err(1, "socket");
strcpy(dummyif, "lo0"); /* dummy */
strlcpy(dummyif, "lo0", sizeof(dummyif)); /* dummy */
if (ioctl(s, SIOCSNDFLUSH_IN6, (caddr_t)&dummyif) < 0)
err(1, "ioctl(SIOCSNDFLUSH_IN6)");
@ -1463,7 +1462,7 @@ setdefif(ifname)
if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
err(1, "socket");
strcpy(ndifreq.ifname, "lo0"); /* dummy */
strlcpy(ndifreq.ifname, "lo0", sizeof(ndifreq.ifname)); /* dummy */
ndifreq.ifindex = ifindex;
if (ioctl(s, SIOCSDEFIFACE_IN6, (caddr_t)&ndifreq) < 0)
@ -1482,7 +1481,7 @@ getdefif()
err(1, "socket");
memset(&ndifreq, 0, sizeof(ndifreq));
strcpy(ndifreq.ifname, "lo0"); /* dummy */
strlcpy(ndifreq.ifname, "lo0", sizeof(ndifreq.ifname)); /* dummy */
if (ioctl(s, SIOCGDEFIFACE_IN6, (caddr_t)&ndifreq) < 0)
err(1, "ioctl(SIOCGDEFIFACE_IN6)");