diff options
| author | mpi <> | 2014-02-07 09:50:04 +0000 |
|---|---|---|
| committer | mpi <> | 2014-02-07 09:50:04 +0000 |
| commit | 10484202fb7550c7f0f57721abcdb8532cbd7b01 (patch) | |
| tree | 9eaee409814c9f60e7dd1ec147e5e3c338cfb0d5 /src/lib/libc | |
| parent | c18b32867c8db4e14f4fe8c68ee6a0a6cefd1743 (diff) | |
| download | openbsd-10484202fb7550c7f0f57721abcdb8532cbd7b01.tar.gz openbsd-10484202fb7550c7f0f57721abcdb8532cbd7b01.tar.bz2 openbsd-10484202fb7550c7f0f57721abcdb8532cbd7b01.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 'src/lib/libc')
| -rw-r--r-- | src/lib/libc/net/ip6opt.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/lib/libc/net/ip6opt.c b/src/lib/libc/net/ip6opt.c index b215f9ac3e..c3609621c2 100644 --- a/src/lib/libc/net/ip6opt.c +++ b/src/lib/libc/net/ip6opt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ip6opt.c,v 1.4 2006/12/09 01:12:28 itojun Exp $ */ | 1 | /* $OpenBSD: ip6opt.c,v 1.5 2014/02/07 09:50:04 mpi Exp $ */ |
| 2 | /* $KAME: ip6opt.c,v 1.18 2005/06/15 07:11:35 keiichi Exp $ */ | 2 | /* $KAME: ip6opt.c,v 1.18 2005/06/15 07:11:35 keiichi Exp $ */ |
| 3 | 3 | ||
| 4 | /* | 4 | /* |
| @@ -383,11 +383,8 @@ inet6_opt_init(void *extbuf, socklen_t extlen) | |||
| 383 | { | 383 | { |
| 384 | struct ip6_ext *ext = (struct ip6_ext *)extbuf; | 384 | struct ip6_ext *ext = (struct ip6_ext *)extbuf; |
| 385 | 385 | ||
| 386 | if (extlen < 0 || (extlen % 8)) | ||
| 387 | return (-1); | ||
| 388 | |||
| 389 | if (ext) { | 386 | if (ext) { |
| 390 | if (extlen == 0) | 387 | if (extlen <= 0 || (extlen % 8)) |
| 391 | return (-1); | 388 | return (-1); |
| 392 | ext->ip6e_len = (extlen >> 3) - 1; | 389 | ext->ip6e_len = (extlen >> 3) - 1; |
| 393 | } | 390 | } |
