diff options
author | Denis Vlasenko | 2006-11-27 23:44:57 +0000 |
---|---|---|
committer | Denis Vlasenko | 2006-11-27 23:44:57 +0000 |
commit | 229b3d207216b23a107e4e1ee5584412f6b9318d (patch) | |
tree | d21a19b020f0ff35f7d0fa24f9812d68057ff06a /networking/libiproute/iptunnel.c | |
parent | e2d3ded3549edd58fe3b39f2254c65f0808bcac2 (diff) | |
download | busybox-229b3d207216b23a107e4e1ee5584412f6b9318d.zip busybox-229b3d207216b23a107e4e1ee5584412f6b9318d.tar.gz |
do not overflow ifr_name. maybe it was safe in some places,
but not everywhere. err to the safe side.
Diffstat (limited to 'networking/libiproute/iptunnel.c')
-rw-r--r-- | networking/libiproute/iptunnel.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/networking/libiproute/iptunnel.c b/networking/libiproute/iptunnel.c index 2b9d305..2080324 100644 --- a/networking/libiproute/iptunnel.c +++ b/networking/libiproute/iptunnel.c @@ -42,7 +42,7 @@ static int do_ioctl_get_ifindex(char *dev) struct ifreq ifr; int fd; - strcpy(ifr.ifr_name, dev); + strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name)); fd = xsocket(AF_INET, SOCK_DGRAM, 0); if (ioctl(fd, SIOCGIFINDEX, &ifr)) { bb_perror_msg("ioctl"); @@ -57,7 +57,7 @@ static int do_ioctl_get_iftype(char *dev) struct ifreq ifr; int fd; - strcpy(ifr.ifr_name, dev); + strncpy(ifr.ifr_name, dev, sizeof(ifr.ifr_name)); fd = xsocket(AF_INET, SOCK_DGRAM, 0); if (ioctl(fd, SIOCGIFHWADDR, &ifr)) { bb_perror_msg("ioctl"); @@ -91,7 +91,7 @@ static int do_get_ioctl(char *basedev, struct ip_tunnel_parm *p) int fd; int err; - strcpy(ifr.ifr_name, basedev); + strncpy(ifr.ifr_name, basedev, sizeof(ifr.ifr_name)); ifr.ifr_ifru.ifru_data = (void*)p; fd = xsocket(AF_INET, SOCK_DGRAM, 0); err = ioctl(fd, SIOCGETTUNNEL, &ifr); @@ -109,9 +109,9 @@ static int do_add_ioctl(int cmd, char *basedev, struct ip_tunnel_parm *p) int err; if (cmd == SIOCCHGTUNNEL && p->name[0]) { - strcpy(ifr.ifr_name, p->name); + strncpy(ifr.ifr_name, p->name, sizeof(ifr.ifr_name)); } else { - strcpy(ifr.ifr_name, basedev); + strncpy(ifr.ifr_name, basedev, sizeof(ifr.ifr_name)); } ifr.ifr_ifru.ifru_data = (void*)p; fd = xsocket(AF_INET, SOCK_DGRAM, 0); @@ -130,9 +130,9 @@ static int do_del_ioctl(char *basedev, struct ip_tunnel_parm *p) int err; if (p->name[0]) { - strcpy(ifr.ifr_name, p->name); + strncpy(ifr.ifr_name, p->name, sizeof(ifr.ifr_name)); } else { - strcpy(ifr.ifr_name, basedev); + strncpy(ifr.ifr_name, basedev, sizeof(ifr.ifr_name)); } ifr.ifr_ifru.ifru_data = (void*)p; fd = xsocket(AF_INET, SOCK_DGRAM, 0); |