aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2025-10-23 07:24:09 +0000
committerMichael Tuexen <tuexen@FreeBSD.org>2025-10-23 07:24:09 +0000
commitbfda98a42027417b2fa74738c63327532013e93b (patch)
tree7691ad7b30c8198ae278cd160fcf80c8363183ee
parentc2b08c13c20d44c3368bcbf738624e5fac461314 (diff)
tcp over udp: don't copy more bytes than avaiable
When copying the data in the first mbuf to get rid of the UDP header, use the correct length. It was copying too much (8 bytes, the length of the UDP header). This only applies to handling TCP over UDP packets. The support for TCP over UDP is disabled by default. Reported by: jtl Reviewed by: Peter Lei MFC after: 3 days Sponsored by: Netflix, Inc.
-rw-r--r--sys/netinet/tcp_subr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index c817c79881d6..b6f428b279b3 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -607,7 +607,7 @@ tcp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *inp,
}
}
m->m_pkthdr.tcp_tun_port = port = uh->uh_sport;
- bcopy(th, uh, m->m_len - off);
+ bcopy(th, uh, m->m_len - off - sizeof(struct udphdr));
m->m_len -= sizeof(struct udphdr);
m->m_pkthdr.len -= sizeof(struct udphdr);
/*