summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authoreadler <eadler@FreeBSD.org>2014-02-04 03:01:33 +0000
committereadler <eadler@FreeBSD.org>2014-02-04 03:01:33 +0000
commit7034cd98a43fb0ab11a0fd3d1779c16e22a5c383 (patch)
tree341c8791a46a3adc4568e4590b929c25ef5d81ea /lib
parent8f40ca632d571c9f82c208f0e6d5389bbe92dd89 (diff)
downloadFreeBSD-src-7034cd98a43fb0ab11a0fd3d1779c16e22a5c383.zip
FreeBSD-src-7034cd98a43fb0ab11a0fd3d1779c16e22a5c383.tar.gz
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
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/net/ip6opt.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/libc/net/ip6opt.c b/lib/libc/net/ip6opt.c
index 003c625..b046e73 100644
--- a/lib/libc/net/ip6opt.c
+++ b/lib/libc/net/ip6opt.c
@@ -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;
}
OpenPOWER on IntegriCloud