From 8033eb298b1fa363632db0cac9880dfe923fbbdc Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Wed, 13 Apr 2016 11:48:05 -0500 Subject: [PATCH] lib/hcrypto/evp.c: missing MD guards --- lib/hcrypto/evp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/hcrypto/evp.c b/lib/hcrypto/evp.c index 0070c8c24..22885d6fd 100644 --- a/lib/hcrypto/evp.c +++ b/lib/hcrypto/evp.c @@ -260,11 +260,15 @@ EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *md, ENGINE *engine) EVP_MD_CTX_cleanup(ctx); ctx->md = md; ctx->engine = engine; + if (md == NULL) + return 0; ctx->ptr = calloc(1, md->ctx_size); if (ctx->ptr == NULL) return 0; } + if (ctx->md == 0) + return 0; return (ctx->md->init)(ctx->ptr); }