mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-23 20:51:09 +01:00
Plug two interface address refcount leaks in early error return cases
in the ioctl path. Reported by: rpaulo Reviewed by: emax MFC after: 3 days
This commit is contained in:
parent
87b8d8bbc9
commit
15cc25e9c0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=236615
@ -1667,14 +1667,19 @@ in6_lifaddr_ioctl(struct socket *so, u_long cmd, caddr_t data,
|
||||
hostid = IFA_IN6(ifa);
|
||||
|
||||
/* prefixlen must be <= 64. */
|
||||
if (64 < iflr->prefixlen)
|
||||
if (64 < iflr->prefixlen) {
|
||||
if (ifa != NULL)
|
||||
ifa_free(ifa);
|
||||
return EINVAL;
|
||||
}
|
||||
prefixlen = iflr->prefixlen;
|
||||
|
||||
/* hostid part must be zero. */
|
||||
sin6 = (struct sockaddr_in6 *)&iflr->addr;
|
||||
if (sin6->sin6_addr.s6_addr32[2] != 0 ||
|
||||
sin6->sin6_addr.s6_addr32[3] != 0) {
|
||||
if (ifa != NULL)
|
||||
ifa_free(ifa);
|
||||
return EINVAL;
|
||||
}
|
||||
} else
|
||||
|
Loading…
Reference in New Issue
Block a user