mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-04 15:40:44 +00:00
netlink: pass the correct arguments for SIOCDIFADDR and SIOCDIFADDR_IN6
These take struct ifreq and struct in6_ifreq respectively. Passing struct in_aliasreq or struct in6_aliasreq means we're supplying a shorter object than expected. While this doesn't actively break things on most architectures other than CHERI it is still wrong. Reported by: CheriBSD Event: Kitchener-Waterloo Hackathon 202406
This commit is contained in:
parent
8ca12190bf
commit
f0829825fb
|
@ -1204,7 +1204,7 @@ handle_deladdr_inet(struct nlmsghdr *hdr, struct nl_parsed_ifa *attrs,
|
|||
return (EINVAL);
|
||||
}
|
||||
|
||||
struct in_aliasreq req = { .ifra_addr = *addr };
|
||||
struct ifreq req = { .ifr_addr = *(struct sockaddr *)addr };
|
||||
|
||||
return (in_control_ioctl(SIOCDIFADDR, &req, ifp, nlp_get_cred(nlp)));
|
||||
}
|
||||
|
@ -1288,7 +1288,7 @@ handle_deladdr_inet6(struct nlmsghdr *hdr, struct nl_parsed_ifa *attrs,
|
|||
return (EINVAL);
|
||||
}
|
||||
|
||||
struct in6_aliasreq req = { .ifra_addr = *addr };
|
||||
struct in6_ifreq req = { .ifr_addr = *addr };
|
||||
|
||||
return (in6_control_ioctl(SIOCDIFADDR_IN6, &req, ifp, nlp_get_cred(nlp)));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue