From: Arran Cudbard-Bell Date: Wed, 25 Aug 2021 20:51:45 +0000 (-0500) Subject: Add safety check for mod_post_auth X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e1e07b312607c06751e3990fa5d170f3a851eec;p=thirdparty%2Ffreeradius-server.git Add safety check for mod_post_auth --- diff --git a/src/modules/rlm_eap/rlm_eap.c b/src/modules/rlm_eap/rlm_eap.c index a20c80796ae..feef54d62ff 100644 --- a/src/modules/rlm_eap/rlm_eap.c +++ b/src/modules/rlm_eap/rlm_eap.c @@ -973,6 +973,16 @@ static unlang_action_t mod_post_auth(rlm_rcode_t *p_result, module_ctx_t const * RETURN_MODULE_NOOP; } + /* + * This should never happen, but we may be here + * because there was an unexpected error in the + * EAP module. + */ + if (!fr_cond_assert(eap_session->this_round) || !fr_cond_assert(eap_session->this_round->request)) { + eap_session_destroy(&eap_session); /* Free the EAP session, and dissociate it from the request */ + RETURN_MODULE_FAIL; + } + /* * Already set to failure, assume something else * added EAP-Message with a failure code, do nothing.