diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-03-19 01:39:05 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-03-19 01:39:05 +0000 |
commit | a546043e29f21fad1bce4459ae2bea4bd768044c (patch) | |
tree | f084c0b872ae70aaa40d1993f555ed1b8fc19e4b /sys/netinet6/raw_ip6.c | |
parent | 1c677ce96e26066b3ac433840322aa6e6d1ea73b (diff) |
check sa_len/family strictly
Diffstat (limited to 'sys/netinet6/raw_ip6.c')
-rw-r--r-- | sys/netinet6/raw_ip6.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index 2aa0881bbb4..933c0d25cab 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_ip6.c,v 1.9 2002/03/15 18:19:53 millert Exp $ */ +/* $OpenBSD: raw_ip6.c,v 1.10 2002/03/19 01:39:04 itojun Exp $ */ /* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */ /* @@ -771,8 +771,18 @@ rip6_usrreq(so, req, m, nam, control, p) error = ENOTCONN; break; } + if (nam->m_len != sizeof(tmp)) { + error = EINVAL; + break; + } + tmp = *mtod(nam, struct sockaddr_in6 *); dst = &tmp; + + if (dst->sin6_family != AF_INET6) { + error = EAFNOSUPPORT; + break; + } } #ifdef ENABLE_DEFAULT_SCOPE if (dst->sin6_scope_id == 0) { |