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
This commit is contained in:
Zhenlei Huang 2022-09-30 09:55:29 +02:00 committed by Kristof Provost
parent 42dc8696df
commit 8707cb19e6

View File

@ -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) {