Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 May 2016 21:37:36 +0000 (UTC)
From:      Don Lewis <truckman@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r299865 - head/sys/net
Message-ID:  <201605152137.u4FLbaNF096547@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: truckman
Date: Sun May 15 21:37:36 2016
New Revision: 299865
URL: https://svnweb.freebsd.org/changeset/base/299865

Log:
  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

Modified:
  head/sys/net/if.c

Modified: head/sys/net/if.c
==============================================================================
--- head/sys/net/if.c	Sun May 15 20:04:43 2016	(r299864)
+++ head/sys/net/if.c	Sun May 15 21:37:36 2016	(r299865)
@@ -2375,6 +2375,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?201605152137.u4FLbaNF096547>