summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2014-02-07 09:50:04 +0000
committermpi <mpi@openbsd.org>2014-02-07 09:50:04 +0000
commit5c02bc5f3c62e31b42081d0c5c3c243471490cc2 (patch)
treeaf8105af864c7c32ebb0411dacf247d48fb80687 /lib/libc
parentremove some logging that makes ssh debugging output very verbose; (diff)
downloadwireguard-openbsd-5c02bc5f3c62e31b42081d0c5c3c243471490cc2.tar.xz
wireguard-openbsd-5c02bc5f3c62e31b42081d0c5c3c243471490cc2.zip
Fix inet6_opt_init() to only check extlen when extbuff is not NULL
as per RFC 3542, from DragonFlyBSD via Eitan Adler. ok bluhm@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/net/ip6opt.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/libc/net/ip6opt.c b/lib/libc/net/ip6opt.c
index b215f9ac3e7..c3609621c27 100644
--- a/lib/libc/net/ip6opt.c
+++ b/lib/libc/net/ip6opt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6opt.c,v 1.4 2006/12/09 01:12:28 itojun Exp $ */
+/* $OpenBSD: ip6opt.c,v 1.5 2014/02/07 09:50:04 mpi Exp $ */
/* $KAME: ip6opt.c,v 1.18 2005/06/15 07:11:35 keiichi Exp $ */
/*
@@ -383,11 +383,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;
}