]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wlantest: Fix EAPOL-Key Key Data padding removal
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 24 Mar 2017 21:34:19 +0000 (23:34 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 26 Mar 2017 18:13:19 +0000 (21:13 +0300)
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
wlantest/rx_eapol.c

index 3366ad4c7d2a333b0d3e38c1c2572d03d8ae8ef6..27011cbaa4c37fd83e174ad60f4034646e95911a 100644 (file)
@@ -653,10 +653,17 @@ static void rx_data_eapol_key_3_of_4(struct wlantest *wt, const u8 *dst,
                        if (p[0] == 0xdd && p[1] == 0x00) {
                                /* Remove padding */
                                plain_len = p - decrypted;
+                               p = NULL;
                                break;
                        }
                        p += 2 + p[1];
                }
+               if (p && p > decrypted && *p == 0xdd &&
+                   p + 1 == decrypted + decrypted_len) {
+                       /* Remove padding */
+                       p--;
+                       plain_len = p - decrypted;
+               }
 
                os_memset(buf, 0, sizeof(buf));
                h = (struct ieee80211_hdr *) buf;