Index: if_vlan.c =================================================================== RCS file: /cvs/src/sys/net/if_vlan.c,v retrieving revision 1.34 diff -u -r1.34 if_vlan.c --- if_vlan.c 1 Feb 2003 00:14:40 -0000 1.34 +++ if_vlan.c 7 Mar 2003 00:19:10 -0000 @@ -241,6 +241,7 @@ struct ifvlan *ifv; struct ether_vlan_header vh; + t = EVL_VLANOFTAG(t); for (i = 0; i < nifvlan; i++) { ifv = &ifv_softc[i]; if (m->m_pkthdr.rcvif == ifv->ifv_p && t == ifv->ifv_tag) @@ -248,14 +249,19 @@ } if (i >= nifvlan) { - if (m->m_pkthdr.len < sizeof(struct ether_header)) + if (m->m_pkthdr.len < sizeof(struct ether_header)) { + m_freem(m); return (-1); + } m_copydata(m, 0, sizeof(struct ether_header), (caddr_t)&vh); vh.evl_proto = vh.evl_encap_proto; vh.evl_tag = htons(t); vh.evl_encap_proto = htons(ETHERTYPE_8021Q); M_PREPEND(m, EVL_ENCAPLEN, M_DONTWAIT); if (m == NULL) + return (-1); + if (m->m_len < sizeof(struct ether_header) && + (m = m_pullup(m, sizeof(struct ether_header))) == NULL) return (-1); m_copyback(m, 0, sizeof(struct ether_vlan_header), (caddr_t)&vh); ether_input_mbuf(m->m_pkthdr.rcvif, m);