correctly handle endianess when parseing RSNE
The length fields in the RSN elements are little endian. We need to convert then to host order when reading.
This commit is contained in:
parent
cee735bf62
commit
247a65c7d5
@ -1,3 +1,5 @@
|
|||||||
|
#include <endian.h>
|
||||||
|
|
||||||
#include "wtp.h"
|
#include "wtp.h"
|
||||||
#include "array.h"
|
#include "array.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
@ -903,7 +905,7 @@ static int nl80211_wlan_setbeacon(struct wifi_wlan* wlan) {
|
|||||||
nla_put_u32(msg, NL80211_ATTR_CIPHER_SUITE_GROUP, ntohl(*(uint32_t *)data));
|
nla_put_u32(msg, NL80211_ATTR_CIPHER_SUITE_GROUP, ntohl(*(uint32_t *)data));
|
||||||
data += sizeof(uint32_t);
|
data += sizeof(uint32_t);
|
||||||
|
|
||||||
suites_num = *(uint16_t *)data;
|
suites_num = le16toh(*(uint16_t *)data);
|
||||||
data += 2;
|
data += 2;
|
||||||
suites = alloca(suites_num * sizeof(uint32_t));
|
suites = alloca(suites_num * sizeof(uint32_t));
|
||||||
|
|
||||||
@ -914,7 +916,7 @@ static int nl80211_wlan_setbeacon(struct wifi_wlan* wlan) {
|
|||||||
}
|
}
|
||||||
nla_put(msg, NL80211_ATTR_CIPHER_SUITES_PAIRWISE, suites_num * sizeof(uint32_t), suites);
|
nla_put(msg, NL80211_ATTR_CIPHER_SUITES_PAIRWISE, suites_num * sizeof(uint32_t), suites);
|
||||||
|
|
||||||
suites_num = *(uint16_t *)data;
|
suites_num = le16toh(*(uint16_t *)data);
|
||||||
data += 2;
|
data += 2;
|
||||||
suites = alloca(suites_num * sizeof(uint32_t));
|
suites = alloca(suites_num * sizeof(uint32_t));
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#include <endian.h>
|
||||||
|
|
||||||
#include "wtp.h"
|
#include "wtp.h"
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
@ -970,7 +972,7 @@ uint32_t wtp_radio_add_station(struct capwap_parsed_packet* packet) {
|
|||||||
data = (uint8_t *)(rsn + 1);
|
data = (uint8_t *)(rsn + 1);
|
||||||
data += 2; // RSN Version
|
data += 2; // RSN Version
|
||||||
data += 4; // Group Chipher Suite
|
data += 4; // Group Chipher Suite
|
||||||
if (*(uint16_t *)data != 1) {
|
if (le16toh(*(uint16_t *)data) != 1) {
|
||||||
log_printf(LOG_DEBUG, "add_station: RSNE IE, wrong Pairwise Cipher Suite Count (%d)",
|
log_printf(LOG_DEBUG, "add_station: RSNE IE, wrong Pairwise Cipher Suite Count (%d)",
|
||||||
*(uint16_t *)data);
|
*(uint16_t *)data);
|
||||||
return CAPWAP_RESULTCODE_FAILURE;
|
return CAPWAP_RESULTCODE_FAILURE;
|
||||||
|
Loading…
Reference in New Issue
Block a user