[openssl] master update

Richard Levitte levitte at openssl.org
Thu Oct 31 11:27:04 UTC 2019


The branch master has been updated
       via  fb1ecf85c9f732e5827771ff243d7a70e06ce112 (commit)
      from  2aa28a1abc893fb16b99ba77e2fecb1cbc8769c7 (commit)


- Log -----------------------------------------------------------------
commit fb1ecf85c9f732e5827771ff243d7a70e06ce112
Author: Richard Levitte <levitte at openssl.org>
Date:   Tue Oct 29 22:17:19 2019 +0100

    evp_pkey_ctx_free_old_ops(): Make sure to assign NULL to freed pointers
    
    Otherwise, should this function be called more than once on the same
    EVP_PKEY_CTX, we get double free issues.
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    (Merged from https://github.com/openssl/openssl/pull/10292)

-----------------------------------------------------------------------

Summary of changes:
 crypto/evp/pmeth_lib.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c
index 1186e5ba3a..350d963086 100644
--- a/crypto/evp/pmeth_lib.c
+++ b/crypto/evp/pmeth_lib.c
@@ -201,10 +201,14 @@ void evp_pkey_ctx_free_old_ops(EVP_PKEY_CTX *ctx)
         if (ctx->op.kex.exchprovctx != NULL && ctx->op.kex.exchange != NULL)
             ctx->op.kex.exchange->freectx(ctx->op.kex.exchprovctx);
         EVP_KEYEXCH_free(ctx->op.kex.exchange);
+        ctx->op.kex.exchprovctx = NULL;
+        ctx->op.kex.exchange = NULL;
     } else if (EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx)) {
         if (ctx->op.sig.sigprovctx != NULL && ctx->op.sig.signature != NULL)
             ctx->op.sig.signature->freectx(ctx->op.sig.sigprovctx);
         EVP_SIGNATURE_free(ctx->op.sig.signature);
+        ctx->op.sig.sigprovctx = NULL;
+        ctx->op.sig.signature = NULL;
     }
 }
 


More information about the openssl-commits mailing list