svn commit: r300278 - stable/10/sys/net

Don Lewis truckman at FreeBSD.org
Fri May 20 06:55:00 UTC 2016


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


More information about the svn-src-stable-10 mailing list