diff options
author | Ralf Haferkamp <rhafer@suse.com> | 2020-07-03 14:51:16 +0200 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2020-07-20 00:21:45 +0400 |
commit | 5cfcbc9f9b33c87d2d9f654b8f1b6efc3c513bdc (patch) | |
tree | 1f5afa54f52fd6497c412a75a588519b26b3676a | |
parent | 79c3b0c2d9d97b2ae818a70eabe4dbc2696f95b8 (diff) | |
download | slirp-5cfcbc9f9b33c87d2d9f654b8f1b6efc3c513bdc.zip slirp-5cfcbc9f9b33c87d2d9f654b8f1b6efc3c513bdc.tar.gz slirp-5cfcbc9f9b33c87d2d9f654b8f1b6efc3c513bdc.tar.bz2 |
Drop bogus IPv6 messages
Drop IPv6 message shorter than what's mentioned in the payload
length header (+ the size of the IPv6 header). They're invalid an could
lead to data leakage in icmp6_send_echoreply().
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-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); |