diff options
-rw-r--r-- | src/ip6_input.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ip6_input.c b/src/ip6_input.c index dfcbfd6..d88d1ab 100644 --- a/src/ip6_input.c +++ b/src/ip6_input.c @@ -49,6 +49,13 @@ void ip6_input(struct mbuf *m) goto bad; } + // Check if the message size is big enough to hold what's + // set in the payload length header. If not this is an invalid + // packet + if (m->m_len < ntohs(ip6->ip_pl) + sizeof(struct ip6)) { + goto bad; + } + /* check ip_ttl for a correct ICMP reply */ if (ip6->ip_hl == 0) { icmp6_send_error(m, ICMP6_TIMXCEED, ICMP6_TIMXCEED_INTRANS); |