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);
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to