diff options
author | Zhenlei Huang <zlei.huang@gmail.com> | 2022-09-30 07:55:29 +0000 |
---|---|---|
committer | Kristof Provost <kp@FreeBSD.org> | 2022-09-30 07:56:15 +0000 |
commit | 8707cb19e68128c181477d87f960182c14e15f12 (patch) | |
tree | f20e8dbefa6d2a4ad906062c6c2bd23216eea3be /sys/net | |
parent | 42dc8696df5e3004ea65fd315aba500d269dbcbf (diff) | |
download | src-8707cb19e68128c181477d87f960182c14e15f12.tar.gz src-8707cb19e68128c181477d87f960182c14e15f12.zip |
if_vxlan(4): Check the size of data available in mbuf before using them
PR: 261711
Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D36794
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if_vxlan.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c index 6c9a3d7e3095..cba2ba4b0a16 100644 --- a/sys/net/if_vxlan.c +++ b/sys/net/if_vxlan.c @@ -2849,6 +2849,12 @@ vxlan_input(struct vxlan_socket *vso, uint32_t vni, struct mbuf **m0, return (ENOENT); ifp = sc->vxl_ifp; + if (m->m_len < ETHER_HDR_LEN && + (m = m_pullup(m, ETHER_HDR_LEN)) == NULL) { + *m0 = NULL; + error = ENOBUFS; + goto out; + } eh = mtod(m, struct ether_header *); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { |