diff options
author | truckman <truckman@FreeBSD.org> | 2016-05-20 06:54:59 +0000 |
---|---|---|
committer | truckman <truckman@FreeBSD.org> | 2016-05-20 06:54:59 +0000 |
commit | a8991e291712a8a069d99b55947fd11b98120353 (patch) | |
tree | 7f5f5af76e1f11faf9a2ce38a8bdf81fff2cef04 | |
parent | 56779b51c7dbe0216a2a06bbb41c6c92cea1c430 (diff) | |
download | FreeBSD-src-a8991e291712a8a069d99b55947fd11b98120353.zip FreeBSD-src-a8991e291712a8a069d99b55947fd11b98120353.tar.gz |
MFC r299865
When handling SIOCSIFNAME ensure that the new interface name is NUL
terminated. Reject the rename attempt if the name is too long.
-rw-r--r-- | sys/net/if.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index af8182b..94c10d1 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -2434,6 +2434,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); |