linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/6] mac80211: wep.c replace magic numbers in IV/ICV removal
@ 2008-07-08 20:47 Harvey Harrison
  0 siblings, 0 replies; only message in thread
From: Harvey Harrison @ 2008-07-08 20:47 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, Johannes Berg

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
 net/mac80211/wep.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index 872d2fc..e50b421 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -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;
 
@@ -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;
-- 
1.5.6.1.322.ge904b



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-07-08 20:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-08 20:47 [PATCH 2/6] mac80211: wep.c replace magic numbers in IV/ICV removal Harvey Harrison

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).