Skip to content

Commit

Permalink
mac80211: wep.c replace magic numbers in IV/ICV removal
Browse files Browse the repository at this point in the history
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Harvey Harrison authored and John W. Linville committed Aug 22, 2008
1 parent c44d040 commit d298487
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions net/mac80211/wep.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,10 @@ int ieee80211_wep_decrypt(struct ieee80211_local *local, struct sk_buff *skb,
return -1;

hdrlen = ieee80211_hdrlen(hdr->frame_control);

if (skb->len < 8 + hdrlen)
if (skb->len < hdrlen + WEP_IV_LEN + WEP_ICV_LEN)
return -1;

len = skb->len - hdrlen - 8;
len = skb->len - hdrlen - WEP_IV_LEN - WEP_ICV_LEN;

keyidx = skb->data[hdrlen + 3] >> 6;

Expand Down Expand Up @@ -303,7 +302,7 @@ ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx)
} else if (!(rx->status->flag & RX_FLAG_IV_STRIPPED)) {
ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key);
/* remove ICV */
skb_trim(rx->skb, rx->skb->len - 4);
skb_trim(rx->skb, rx->skb->len - WEP_ICV_LEN);
}

return RX_CONTINUE;
Expand Down

0 comments on commit d298487

Please sign in to comment.