diff options
| author | Jun-ichiro itojun Hagino <itojun@FreeBSD.org> | 2000-10-23 07:11:01 +0000 |
|---|---|---|
| committer | Jun-ichiro itojun Hagino <itojun@FreeBSD.org> | 2000-10-23 07:11:01 +0000 |
| commit | d31944e6ec798fa765ad8608b52b2fe32435030a (patch) | |
| tree | de7398eef46e1548ad01970291aae9d4c6c1a153 /sys/netinet/tcp_subr.c | |
| parent | a91a9fde81070fd9202d6d010421bbecc711929a (diff) | |
Notes
Diffstat (limited to 'sys/netinet/tcp_subr.c')
| -rw-r--r-- | sys/netinet/tcp_subr.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 4541f4e06ed5..25c9b66b9da6 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1012,6 +1012,7 @@ tcp6_ctlinput(cmd, sa, d) } else { m = NULL; ip6 = NULL; + off = 0; /* fool gcc */ } /* @@ -1036,7 +1037,11 @@ tcp6_ctlinput(cmd, sa, d) m->m_pkthdr.rcvif != NULL) s.s6_addr16[1] = htons(m->m_pkthdr.rcvif->if_index); - if (m->m_len < off + sizeof(*thp)) { + /* check if we can safely examine src and dst ports */ + if (m->m_pkthdr.len < off + sizeof(th)) + return; + + if (m->m_len < off + sizeof(th)) { /* * this should be rare case * because now MINCLSIZE is "(MHLEN + 1)", |
