summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortruckman <truckman@FreeBSD.org>2016-05-15 21:37:36 +0000
committertruckman <truckman@FreeBSD.org>2016-05-15 21:37:36 +0000
commit4d98e411343d176a82e06154becec55a04fa07ca (patch)
treec67e37092d8f1345642bdfbbc7c65b225e00edee
parentfc8a4ae06d7bd393017f0611999439cb0a5e0c85 (diff)
downloadFreeBSD-src-4d98e411343d176a82e06154becec55a04fa07ca.zip
FreeBSD-src-4d98e411343d176a82e06154becec55a04fa07ca.tar.gz
When handling SIOCSIFNAME ensure that the new interface name is NUL
terminated. Reject the rename attempt if the name is too long. MFC after: 1 week
-rw-r--r--sys/net/if.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index e816442..800cb70 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -2375,6 +2375,11 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
return (error);
if (new_name[0] == '\0')
return (EINVAL);
+ if (new_name[IFNAMSIZ-1] != '\0') {
+ new_name[IFNAMSIZ-1] = '\0';
+ if (strlen(new_name) == IFNAMSIZ-1)
+ return (EINVAL);
+ }
if (ifunit(new_name) != NULL)
return (EEXIST);
OpenPOWER on IntegriCloud