summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenys Vlasenko2016-07-04 17:38:01 +0200
committerDenys Vlasenko2016-07-04 17:38:01 +0200
commitee772a0d90e2775cbe40072fd5217552c260a9aa (patch)
treee677e9289b7d4aa4a0e8835020c86fe2221988b0 /networking
parent44399e00ffa73270cd7fc108c983d3b1705b9d86 (diff)
downloadbusybox-ee772a0d90e2775cbe40072fd5217552c260a9aa.zip
busybox-ee772a0d90e2775cbe40072fd5217552c260a9aa.tar.gz
arp: fix buffer overflow. Closes 9071
function old new delta arp_main 1910 1898 -12 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r--networking/arp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/networking/arp.c b/networking/arp.c
index 9381eb5..69a5816 100644
--- a/networking/arp.c
+++ b/networking/arp.c
@@ -178,7 +178,7 @@ static int arp_del(char **args)
if (flags == 0)
flags = 3;
- strncpy(req.arp_dev, device, sizeof(req.arp_dev));
+ strncpy_IFNAMSIZ(req.arp_dev, device);
err = -1;
@@ -219,7 +219,7 @@ static void arp_getdevhw(char *ifname, struct sockaddr *sa)
struct ifreq ifr;
const struct hwtype *xhw;
- strcpy(ifr.ifr_name, ifname);
+ strncpy_IFNAMSIZ(ifr.ifr_name, ifname);
ioctl_or_perror_and_die(sockfd, SIOCGIFHWADDR, &ifr,
"can't get HW-Address for '%s'", ifname);
if (hw_set && (ifr.ifr_hwaddr.sa_family != hw->type)) {
@@ -332,7 +332,7 @@ static int arp_set(char **args)
/* Fill in the remainder of the request. */
req.arp_flags = flags;
- strncpy(req.arp_dev, device, sizeof(req.arp_dev));
+ strncpy_IFNAMSIZ(req.arp_dev, device);
/* Call the kernel. */
if (option_mask32 & ARP_OPT_v)