summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Popelka <jpopelka@redhat.com>2011-12-07 19:02:07 +0100
committerJiri Popelka <jpopelka@redhat.com>2012-01-05 12:22:43 +0100
commit1f2c75dcb9998b2f4875adaa9c0e798d83aaaa77 (patch)
treee4b81554a9001ea38f9b3554891b70c784168415
parentcf3378018ca7c296a3bfc0170feb8883493e0944 (diff)
downloadnet-tools-1f2c75dcb9998b2f4875adaa9c0e798d83aaaa77.tar.gz
net-tools-1f2c75dcb9998b2f4875adaa9c0e798d83aaaa77.tar.bz2
net-tools-1f2c75dcb9998b2f4875adaa9c0e798d83aaaa77.zip
nameif crash for long interface names (RHBZ #209120)
I'm not sure how to reproduce that, but the patch is quite straightforward.
-rw-r--r--nameif.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/nameif.c b/nameif.c
index 209d492..27fcbb4 100644
--- a/nameif.c
+++ b/nameif.c
@@ -99,8 +99,8 @@ int setname(char *oldname, char *newname)
struct ifreq ifr;
opensock();
memset(&ifr,0,sizeof(struct ifreq));
- strcpy(ifr.ifr_name, oldname);
- strcpy(ifr.ifr_newname, newname);
+ strncpy(ifr.ifr_name, oldname, IFNAMSIZ);
+ strncpy(ifr.ifr_newname, newname, IFNAMSIZ);
return ioctl(ctl_sk, SIOCSIFNAME, &ifr);
}