Date: Fri, 20 May 2016 06:54:59 +0000 (UTC) From: Don Lewis <truckman@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r300278 - stable/10/sys/net Message-ID: <201605200654.u4K6sx6N091026@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: truckman Date: Fri May 20 06:54:59 2016 New Revision: 300278 URL: https://svnweb.freebsd.org/changeset/base/300278 Log: MFC r299865 When handling SIOCSIFNAME ensure that the new interface name is NUL terminated. Reject the rename attempt if the name is too long. Modified: stable/10/sys/net/if.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/if.c ============================================================================== --- stable/10/sys/net/if.c Fri May 20 06:54:58 2016 (r300277) +++ stable/10/sys/net/if.c Fri May 20 06:54:59 2016 (r300278) @@ -2434,6 +2434,11 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605200654.u4K6sx6N091026>