3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-24 16:49:25 +01:00

mpdu: tolerate technically illegal but harmless cloned IEs

This commit is contained in:
Vivek Das Mohapatra 2024-10-05 03:19:29 +01:00 committed by Denis Kenzior
parent 6cc6a8a2cb
commit 1a554a300d
2 changed files with 24 additions and 0 deletions

View File

@ -598,6 +598,23 @@ static inline const unsigned char *ie_tlv_iter_get_data(
return iter->data;
}
static inline bool ie_tlv_iter_data_eq(struct ie_tlv_iter *a,
struct ie_tlv_iter *b)
{
if (a == b)
return true;
if (a == NULL || b == NULL)
return false;
if (ie_tlv_iter_get_length(a) != ie_tlv_iter_get_length(b))
return false;
return memcmp(ie_tlv_iter_get_data(a),
ie_tlv_iter_get_data(b),
ie_tlv_iter_get_length(a)) == 0;
}
void *ie_tlv_extract_wsc_payload(const uint8_t *ies, size_t len,
ssize_t *out_len);
void *ie_tlv_encapsulate_wsc_payload(const uint8_t *data, size_t len,

View File

@ -398,9 +398,16 @@ static bool validate_mgmt_ies(const uint8_t *ies, size_t ies_len,
memcpy(&clone, &iter, sizeof(clone));
/*
* Some APs send completely identical duplicate IEs:
* Since these are harmless (and ignored by us) we're
* going to allow them here for interoperability.
*/
while (ie_tlv_iter_next(&clone)) {
if (ie_tlv_iter_get_tag(&clone) != tag)
continue;
else if (ie_tlv_iter_data_eq(&iter, &clone))
continue;
return false;
}