svn commit: r299865 - head/sys/net

Don Lewis truckman at FreeBSD.org
Sun May 15 21:37:38 UTC 2016


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);
 


More information about the svn-src-all mailing list