Fix 4-byte overflow in ipv6_writemask.

This bug could cause some IPv6 table prefix delete requests to fail.

Obtained from:	Yandex LLC
This commit is contained in:
Alexander V. Chernikov 2016-06-05 10:33:53 +00:00
parent 912517a7d4
commit 37aefa2ad1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=301440

View File

@ -590,7 +590,8 @@ ipv6_writemask(struct in6_addr *addr6, uint8_t mask)
for (cp = (uint32_t *)addr6; mask >= 32; mask -= 32)
*cp++ = 0xFFFFFFFF;
*cp = htonl(mask ? ~((1 << (32 - mask)) - 1) : 0);
if (mask > 0)
*cp = htonl(mask ? ~((1 << (32 - mask)) - 1) : 0);
}
#endif