From ae7c65b17105e353781c7becd6fde2b532cbceb2 Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Fri, 19 Apr 2019 17:21:35 +0000 Subject: [PATCH] Avoid a buffer overwrite in rip6_output() when computing the checksum as requested by the user via the IPPROTO_IPV6 level socket option IPV6_CHECKSUM. The check if there are enough bytes in the packet to store the checksum at the requested offset was wrong by 1. Reviewed by: bz@ MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D19967 --- sys/netinet6/raw_ip6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index bdaf36582f27..d24b3ceaaa47 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -495,7 +495,7 @@ rip6_output(struct mbuf *m, struct socket *so, ...) off = offsetof(struct icmp6_hdr, icmp6_cksum); else off = in6p->in6p_cksum; - if (plen < off + 1) { + if (plen < off + 2) { error = EINVAL; goto bad; }