1 openssl: avoid NULL pointer dereference in EVP_DigestInit_ex()
3 We should avoid accessing the type pointer if it's NULL,
4 this could happen if ctx->digest is not NULL.
6 Upstream-Status: Submitted
7 http://www.mail-archive.com/openssl-dev@openssl.org/msg32860.html
9 Signed-off-by: Xufeng Zhang <xufeng.zhang@windriver.com>
11 Index: openssl-1.0.2h/crypto/evp/digest.c
12 ===================================================================
13 --- openssl-1.0.2h.orig/crypto/evp/digest.c
14 +++ openssl-1.0.2h/crypto/evp/digest.c
15 @@ -211,7 +211,7 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, c
19 - if (ctx->digest != type) {
20 + if (type && (ctx->digest != type)) {
21 if (ctx->digest && ctx->digest->ctx_size) {
22 OPENSSL_free(ctx->md_data);