From 1f2c75dcb9998b2f4875adaa9c0e798d83aaaa77 Mon Sep 17 00:00:00 2001 From: Jiri Popelka Date: Wed, 7 Dec 2011 19:02:07 +0100 Subject: nameif crash for long interface names (RHBZ #209120) I'm not sure how to reproduce that, but the patch is quite straightforward. --- nameif.c | 4 ++-- 1 file 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); } -- cgit v1.2.3