From: Jiri Popelka Date: Wed, 7 Dec 2011 17:43:03 +0000 (+0100) Subject: buffer overflow in arp (RHBZ #164695) X-Git-Tag: upstream/1.99_20121209git~43 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=96b25f189e5b584a1d6ece3a1a81dacb6d53969b;p=platform%2Fupstream%2Fnet-tools.git buffer overflow in arp (RHBZ #164695) Steps to Reproduce: 1. arp -s 172.16.1.3 00:80:c8:04:05:06 -D eth0 --- diff --git a/arp.c b/arp.c index 8a376ec..72e87d6 100644 --- a/arp.c +++ b/arp.c @@ -243,7 +243,7 @@ static int arp_getdevhw(char *ifname, struct sockaddr *sa, struct hwtype *hw) struct ifreq ifr; struct hwtype *xhw; - strcpy(ifr.ifr_name, ifname); + strncpy(ifr.ifr_name, ifname, IFNAMSIZ); if (ioctl(sockfd, SIOCGIFHWADDR, &ifr) < 0) { fprintf(stderr, _("arp: cant get HW-Address for `%s': %s.\n"), ifname, strerror(errno)); return (-1);