Commit a1f20b8e4b for strongswan.org
commit a1f20b8e4b97f7de857c53190f59f1b1281cd0a6
Author: Tobias Brunner <tobias@strongswan.org>
Date: Wed Nov 18 08:31:05 2026 +0100
eap-mschapv2: Fix memory leaks after failed length checks on client
Closes strongswan/strongswan#3210
Fixes: f98cdf7a4765 ("adding plugin for EAP-MS-CHAPv2")
diff --git a/src/libcharon/plugins/eap_mschapv2/eap_mschapv2.c b/src/libcharon/plugins/eap_mschapv2/eap_mschapv2.c
index 145bc2e5f5..e5c4a8291e 100644
--- a/src/libcharon/plugins/eap_mschapv2/eap_mschapv2.c
+++ b/src/libcharon/plugins/eap_mschapv2/eap_mschapv2.c
@@ -899,6 +899,7 @@ static status_t process_peer_success(private_eap_mschapv2_t *this,
{
DBG1(DBG_IKE, "received invalid EAP-MS-CHAPv2 message: "
"invalid auth string");
+ enumerator->destroy(enumerator);
goto error;
}
chunk_free(&auth_string);
@@ -991,8 +992,9 @@ static status_t process_peer_failure(private_eap_mschapv2_t *this,
token += 2;
if (strlen(token) != 2 * CHALLENGE_LEN)
{
- DBG1(DBG_IKE, "received invalid EAP-MS-CHAPv2 message:"
+ DBG1(DBG_IKE, "received invalid EAP-MS-CHAPv2 message: "
"invalid challenge");
+ enumerator->destroy(enumerator);
goto error;
}
chunk_free(&challenge);