ossl_provider_set_module_path: Prevent potential UAF

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15680)
This commit is contained in:
Tomas Mraz 2021-06-09 16:27:05 +02:00 committed by Pauli
parent 7afef721ff
commit 6cf811e867

View File

@ -483,6 +483,7 @@ void ossl_provider_free(OSSL_PROVIDER *prov)
int ossl_provider_set_module_path(OSSL_PROVIDER *prov, const char *module_path)
{
OPENSSL_free(prov->path);
prov->path = NULL;
if (module_path == NULL)
return 1;
if ((prov->path = OPENSSL_strdup(module_path)) != NULL)