From 29d9e6f01aec8d51c2cce1343f49c522077e776a Mon Sep 17 00:00:00 2001 From: Nachiket Kukade Date: Fri, 18 Aug 2023 17:06:20 +0530 Subject: [PATCH] fix(supplicant): Ignore EAPOL non-key frames in EAPOL txdone callback --- components/wpa_supplicant/src/rsn_supp/wpa.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/components/wpa_supplicant/src/rsn_supp/wpa.c b/components/wpa_supplicant/src/rsn_supp/wpa.c index 7106cb58152..12f5b398205 100644 --- a/components/wpa_supplicant/src/rsn_supp/wpa.c +++ b/components/wpa_supplicant/src/rsn_supp/wpa.c @@ -2653,11 +2653,19 @@ void eapol_txcb(uint8_t *eapol_payload, size_t len, bool tx_failure) struct wpa_sm *sm = &gWpaSm; u8 isdeauth = 0; //no_zero value is the reason for deauth - if (len < (sizeof(struct ieee802_1x_hdr) + sizeof(struct wpa_eapol_key))) { - wpa_printf(MSG_ERROR, "EAPOL TxDone with invalid payload len! (len - %d)", len); + if (len < sizeof(struct ieee802_1x_hdr)) { + /* Invalid 802.1X header, ignore */ return; } hdr = (struct ieee802_1x_hdr *) eapol_payload; + if (hdr->type != IEEE802_1X_TYPE_EAPOL_KEY) { + /* Ignore EAPOL non-key frames */ + return; + } + if (len < (sizeof(struct ieee802_1x_hdr) + sizeof(struct wpa_eapol_key))) { + wpa_printf(MSG_ERROR, "EAPOL TxDone with invalid payload len! (len - %zu)", len); + return; + } key = (struct wpa_eapol_key *) (hdr + 1); switch(WPA_SM_STATE(sm)) {