From 0884633577c0dbfaae8bf35c3b5b91a8016b25a8 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 16 May 2016 22:25:25 +0300 Subject: [PATCH] EAP-PAX: Do not debug print result if eap_pax_mac() fails This gets rid of a valgrind warning on uninitialized memory read in the eap_proto_pax_errors test case where the result was used after the failed eap_pax_mac() call. Signed-off-by: Jouni Malinen --- src/eap_peer/eap_pax.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/eap_peer/eap_pax.c b/src/eap_peer/eap_pax.c index 5f0b7fb4f..a7012d287 100644 --- a/src/eap_peer/eap_pax.c +++ b/src/eap_peer/eap_pax.c @@ -278,8 +278,15 @@ static struct wpabuf * eap_pax_process_std_3(struct eap_pax_data *data, pos, EAP_PAX_MAC_LEN); if (eap_pax_mac(data->mac_id, data->ck, EAP_PAX_CK_LEN, data->rand.r.y, EAP_PAX_RAND_LEN, - (u8 *) data->cid, data->cid_len, NULL, 0, mac) < 0 || - os_memcmp_const(pos, mac, EAP_PAX_MAC_LEN) != 0) { + (u8 *) data->cid, data->cid_len, NULL, 0, mac) < 0) { + wpa_printf(MSG_INFO, + "EAP-PAX: Could not derive MAC_CK(B, CID)"); + ret->methodState = METHOD_DONE; + ret->decision = DECISION_FAIL; + return NULL; + } + + if (os_memcmp_const(pos, mac, EAP_PAX_MAC_LEN) != 0) { wpa_printf(MSG_INFO, "EAP-PAX: Invalid MAC_CK(B, CID) " "received"); wpa_hexdump(MSG_MSGDUMP, "EAP-PAX: expected MAC_CK(B, CID)",