We should avoid accessing the type pointer if it's NULL,
this could happen if ctx->digest is not NULL.
---
 crypto/evp/digest.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c
index 982ba2b..96122ea 100644
--- a/crypto/evp/digest.c
+++ b/crypto/evp/digest.c
@@ -195,7 +195,7 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, 
ENGINE *impl)
                return 0;
                }
 #endif
-       if (ctx->digest != type)
+       if (type && (ctx->digest != type))
                {
                if (ctx->digest && ctx->digest->ctx_size)
                        OPENSSL_free(ctx->md_data);
-- 
1.7.0.2

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       openssl-dev@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to