diff options
author | Robert Sauter <sauter@locoslab.com> | 2018-03-28 22:49:58 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2018-03-30 07:29:03 +0000 |
commit | a67082d35438cd02cf5d75b0c1e8c7410c580ec9 (patch) | |
tree | 24e6d7b16fb94809aa3a3c253e3881556ee556c0 /epan/dissectors/packet-mle.c | |
parent | afede5f8677cb4d580d81910c767cc5e6c58e442 (diff) |
IEEE 802.15.4: fix decryption results based on uninitialized data
Refactor ieee802154_set_mac_key to return the number of keys set and
only try to decrypt with the alt_key if actually provided
Bug: 14522
Change-Id: I40802dff8c08f7f82b792fb16f5f91aa3b9e20cc
Reviewed-on: https://code.wireshark.org/review/26677
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-mle.c')
-rw-r--r-- | epan/dissectors/packet-mle.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/epan/dissectors/packet-mle.c b/epan/dissectors/packet-mle.c index 57c040a2a1..5a2b79715b 100644 --- a/epan/dissectors/packet-mle.c +++ b/epan/dissectors/packet-mle.c @@ -497,7 +497,7 @@ dissect_mle_decrypt(tvbuff_t * tvb, return ptext_tvb; } /* dissect_mle_decrypt */ -void register_mle_key_hash_handler(guint hash_identifier, ieee802154_set_mac_key_func key_func) +void register_mle_key_hash_handler(guint hash_identifier, ieee802154_set_key_func key_func) { /* Ensure no duplication */ DISSECTOR_ASSERT(wmem_tree_lookup32(mle_key_hash_handlers, hash_identifier) == NULL); @@ -506,9 +506,9 @@ void register_mle_key_hash_handler(guint hash_identifier, ieee802154_set_mac_key } /* Set MLE key function. */ -static gboolean ieee802154_set_mle_key(ieee802154_packet *packet, unsigned char *key, unsigned char *alt_key, ieee802154_key_t* uat_key) +static guint ieee802154_set_mle_key(ieee802154_packet *packet, unsigned char *key, unsigned char *alt_key, ieee802154_key_t *uat_key) { - mle_set_mle_key_func func = (mle_set_mle_key_func)wmem_tree_lookup32(mle_key_hash_handlers, uat_key->hash_type); + ieee802154_set_key_func func = (ieee802154_set_key_func)wmem_tree_lookup32(mle_key_hash_handlers, uat_key->hash_type); if (func != NULL) return func(packet, key, alt_key, uat_key); @@ -518,10 +518,10 @@ static gboolean ieee802154_set_mle_key(ieee802154_packet *packet, unsigned char if (packet->key_index == uat_key->key_index) { memcpy(key, uat_key->key, IEEE802154_CIPHER_SIZE); - return TRUE; + return 1; } - return FALSE; + return 0; } static int |