backout 1.11. ifname in struct ifreq should be copyed by strncpy.

Pointed out by:	itojun
This commit is contained in:
ume 2003-08-17 11:54:58 +00:00
parent d5caa62eec
commit 851d8a32e3

View File

@ -80,7 +80,7 @@ interface_up(char *name)
struct ifreq ifr;
int llflag;
strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
if (ioctl(ifsock, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) {
warnmsg(LOG_WARNING, __func__, "ioctl(SIOCGIFFLAGS): %s",
@ -129,7 +129,7 @@ interface_status(struct ifinfo *ifinfo)
/* get interface flags */
memset(&ifr, 0, sizeof(ifr));
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
if (ioctl(ifsock, SIOCGIFFLAGS, &ifr) < 0) {
warnmsg(LOG_ERR, __func__, "ioctl(SIOCGIFFLAGS) on %s: %s",
ifname, strerror(errno));
@ -147,7 +147,7 @@ interface_status(struct ifinfo *ifinfo)
if (!ifinfo->mediareqok)
goto active;
memset(&ifmr, 0, sizeof(ifmr));
strlcpy(ifmr.ifm_name, ifname, sizeof(ifmr.ifm_name));
strncpy(ifmr.ifm_name, ifname, sizeof(ifmr.ifm_name));
if (ioctl(ifsock, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) {
if (errno != EINVAL) {
@ -333,7 +333,7 @@ get_llflag(const char *name)
continue;
memset(&ifr6, 0, sizeof(ifr6));
strlcpy(ifr6.ifr_name, name, sizeof(ifr6.ifr_name));
strncpy(ifr6.ifr_name, name, sizeof(ifr6.ifr_name));
memcpy(&ifr6.ifr_ifru.ifru_addr, sin6, sin6->sin6_len);
if (ioctl(s, SIOCGIFAFLAG_IN6, &ifr6) < 0) {
warnmsg(LOG_ERR, __func__,