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
This commit is contained in:
parent
fc8a4ae06d
commit
4d98e41134
@ -2375,6 +2375,11 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
|
||||
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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user