diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2002-06-22 23:11:36 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2002-06-22 23:11:36 +0000 |
commit | b2560416c80ac31b6658de7966e8baa81f98c0e6 (patch) | |
tree | 20b1ec1489021fd192053781bc61ec0040e12731 | |
parent | 5285b13d986e7b83d7613493f4dafc4109ca0b5c (diff) |
Fetch the WEP IV before building a subtree for the WEP parameters, so we
don't end up with an empty tree for the parameters.
Fetch the IV and key regardless of whether we're building a protocol
tree; that ensures that we know we have the IV/key before we try to
dissect stuff after it.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@5741 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r-- | packet-ieee80211.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/packet-ieee80211.c b/packet-ieee80211.c index f84b60b3aa..57b740296e 100644 --- a/packet-ieee80211.c +++ b/packet-ieee80211.c @@ -3,7 +3,7 @@ * Copyright 2000, Axis Communications AB * Inquiries/bugreports should be sent to Johan.Jorgensen@axis.com * - * $Id: packet-ieee80211.c,v 1.69 2002/06/22 10:24:35 guy Exp $ + * $Id: packet-ieee80211.c,v 1.70 2002/06/22 23:11:36 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1565,7 +1565,18 @@ dissect_ieee80211_common (tvbuff_t * tvb, packet_info * pinfo, */ gboolean can_decrypt = FALSE; proto_tree *wep_tree = NULL; + guint32 iv; + guint8 key; + /* + * XXX - pass the IV and key to "try_decrypt_wep()", and have it pass + * them to "wep_decrypt()", rather than having "wep_decrypt()" extract + * them itself. + * + * Also, just pass the data *following* the WEP parameters as the + * buffer to decrypt. + */ + iv = tvb_get_letoh24(tvb, hdr_len); if (tree) { proto_item *wep_fields; @@ -1573,19 +1584,15 @@ dissect_ieee80211_common (tvbuff_t * tvb, packet_info * pinfo, "WEP parameters"); wep_tree = proto_item_add_subtree (wep_fields, ett_wep_parameters); - proto_tree_add_item (wep_tree, hf_wep_iv, tvb, hdr_len, 3, TRUE); - - proto_tree_add_uint (wep_tree, hf_wep_key, tvb, hdr_len + 3, 1, - COOK_WEP_KEY (tvb_get_guint8 (tvb, hdr_len + 3))); + proto_tree_add_uint (wep_tree, hf_wep_iv, tvb, hdr_len, 3, iv); } + key = COOK_WEP_KEY (tvb_get_guint8 (tvb, hdr_len + 3)); + if (tree) + proto_tree_add_uint (wep_tree, hf_wep_key, tvb, hdr_len + 3, 1, key); /* Subtract out the length of the IV. */ len -= 4; reported_len -= 4; - if (len < 0 || reported_len < 0) { - /* We don't have anything beyond the IV. */ - return; - } /* * Well, this packet should, in theory, have an ICV. |