wpa_supplicant: Fix invalid pointer deference and memleak

Add following changes as part of this:

1. EAP client will crash during validation of key size when CA
certs and keys not present. Add changes to validate it first.
2. Free memory allocated in TLS context
This commit is contained in:
kapil.gupta 2020-07-19 14:07:00 +05:30 committed by bot
parent 70fb594873
commit 1d59af5c84

View File

@ -384,7 +384,7 @@ static void tls_set_ciphersuite(tls_context_t *tls)
if (tls->ciphersuite[0]) {
mbedtls_ssl_conf_ciphersuites(&tls->conf, tls->ciphersuite);
} else if (mbedtls_pk_get_bitlen(&tls->clientkey) > 2048 ||
mbedtls_pk_get_bitlen(&tls->cacert_ptr->pk) > 2048) {
(tls->cacert_ptr && mbedtls_pk_get_bitlen(&tls->cacert_ptr->pk) > 2048)) {
mbedtls_ssl_conf_ciphersuites(&tls->conf, eap_ciphersuite_preference);
}
}
@ -504,6 +504,7 @@ void tls_connection_deinit(void *tls_ctx, struct tls_connection *conn)
{
/* Free ssl ctx and data */
tls_mbedtls_conn_delete((tls_context_t *) conn->tls);
os_free(conn->tls);
conn->tls = NULL;
/* Data in in ssl ctx, free connection */
os_free(conn);