wlantest: Fix EAPOL-Key Key Data padding removal

The case where a single 0xdd octet without any 0x00 octets is used as
padding was addressed incorrectly and that ended up truncating one octet
of the actual plaintext version of the Key Data value. Fix this by
removing the unnecessary change to the p pointer before calculating the
new length since p is already pointing to one past the last octet of the
full plaintext.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2020-09-30 00:19:53 +03:00 committed by Jouni Malinen
parent 13feeaa104
commit 0482414743

View File

@ -725,7 +725,6 @@ static void rx_data_eapol_key_3_of_4(struct wlantest *wt, const u8 *dst,
if (p && p > decrypted && p + 1 == decrypted + decrypted_len && if (p && p > decrypted && p + 1 == decrypted + decrypted_len &&
*p == 0xdd) { *p == 0xdd) {
/* Remove padding */ /* Remove padding */
p--;
plain_len = p - decrypted; plain_len = p - decrypted;
} }