Check for a failure return from EVP_MD_CTX_new() in OCSP_basic_sign().
authorPauli <paul.dale@oracle.com>
Sun, 2 Sep 2018 21:29:45 +0000 (07:29 +1000)
committerPauli <paul.dale@oracle.com>
Sun, 2 Sep 2018 23:57:28 +0000 (09:57 +1000)
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7087)

crypto/ocsp/ocsp_srv.c

index eff6ddbd605765b85d732bb855eb3bd4c8152389..6bd6f7b6d8928330605ca14615869c106ae8053b 100644 (file)
@@ -237,6 +237,9 @@ int OCSP_basic_sign(OCSP_BASICRESP *brsp,
     EVP_PKEY_CTX *pkctx = NULL;
     int i;
 
+    if (ctx == NULL)
+        return 0;
+
     if (!EVP_DigestSignInit(ctx, &pkctx, dgst, NULL, key)) {
         EVP_MD_CTX_free(ctx);
         return 0;