libc/net: Fix some issues in inet6_opt_init() (from RFC 3542):
* The RFC says (in section 10.1) that only when extbuf is not NULL, extlen shall be checked, so don't perform this check when NULL is passed. * socklen_t is unsigned, so checking extlen for less than zero is not needed. Submitted by: swildner@dragonflybsd.org Reviewed by: Mark Martinec <Mark.Martinec+freebsd@ijs.si> Reviewed by: hrs Obtained by: DragonFlyBSD
This commit is contained in:
parent
953c2c47eb
commit
c6c4136a0a
@ -381,11 +381,8 @@ inet6_opt_init(void *extbuf, socklen_t extlen)
|
||||
{
|
||||
struct ip6_ext *ext = (struct ip6_ext *)extbuf;
|
||||
|
||||
if (extlen < 0 || (extlen % 8))
|
||||
return(-1);
|
||||
|
||||
if (ext) {
|
||||
if (extlen == 0)
|
||||
if (extlen == 0 || (extlen % 8))
|
||||
return(-1);
|
||||
ext->ip6e_len = (extlen >> 3) - 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user