Ticket #1335: 01_secfix-0.9.3-sizecheck-take3.patch
| File 01_secfix-0.9.3-sizecheck-take3.patch, 2.4 kB (added by mrenzmann, 5 years ago) |
|---|
-
madwifi-0.9.3/net80211/ieee80211_input.c
old new 693 693 694 694 /* NB: assumes linear (i.e., non-fragmented) skb */ 695 695 696 /* check length > header */ 697 if (skb->len < sizeof(struct ether_header) + LLC_SNAPFRAMELEN 698 + roundup(sizeof(struct athl2p_tunnel_hdr) - 2, 4) + 2) { 699 IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT, 700 ni->ni_macaddr, "data", "%s", "decap error"); 701 vap->iv_stats.is_rx_decap++; 702 IEEE80211_NODE_STAT(ni, rx_decap); 703 goto err; 704 } 705 696 706 /* get to the tunneled headers */ 697 707 ath_hdr = (struct athl2p_tunnel_hdr *) 698 708 skb_pull(skb, sizeof(struct ether_header) + LLC_SNAPFRAMELEN); 699 /* ignore invalid frames */ 700 if(ath_hdr == NULL) 709 eh_tmp = (struct ether_header *) 710 skb_pull(skb, roundup(sizeof(struct athl2p_tunnel_hdr) - 2, 4) + 2); 711 /* sanity check for malformed 802.3 length */ 712 frame_len = ntohs(eh_tmp->ether_type); 713 if (skb->len < roundup(sizeof(struct ether_header) + frame_len, 4)) { 714 IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT, 715 ni->ni_macaddr, "data", "%s", "decap error"); 716 vap->iv_stats.is_rx_decap++; 717 IEEE80211_NODE_STAT(ni, rx_decap); 701 718 goto err; 702 719 } 720 703 721 /* only implementing FF now. drop all others. */ 704 722 if (ath_hdr->proto != ATH_L2TUNNEL_PROTO_FF) { 705 723 IEEE80211_DISCARD_MAC(vap, … … 712 730 } 713 731 vap->iv_stats.is_rx_ffcnt++; 714 732 715 /* move past the tunneled header, with alignment */716 skb_pull(skb, roundup(sizeof(struct athl2p_tunnel_hdr) - 2, 4) + 2);717 718 733 skb1 = skb_clone(skb, GFP_ATOMIC); /* XXX: GFP_ATOMIC is overkill? */ 719 eh_tmp = (struct ether_header *)skb->data;720 721 /* ether_type must be length*/722 frame_len = ntohs(eh_tmp->ether_type);723 734 724 735 /* we now have 802.3 MAC hdr followed by 802.2 LLC/SNAP. convert to DIX */ 725 736 athff_decap(skb); … … 729 740 730 741 /* prepare second tunneled frame */ 731 742 skb_pull(skb1, roundup(sizeof(struct ether_header) + frame_len, 4)); 732 eh_tmp = (struct ether_header *)skb1->data;733 frame_len = ntohs(eh_tmp->ether_type);734 743 athff_decap(skb1); 735 744 736 745 /* deliver the frames */
