File 0010-Fix-Null-pointer-deref-in-X509_issuer_and_serial_has.patch of Package mingw64-openssl

From fb01b3e89f63bf94d14af54caa56591ba7ae681b Mon Sep 17 00:00:00 2001
From: Ralf Habacker <ralf.habacker@freenet.de>
Date: Thu, 19 Feb 2026 14:41:25 +0100
Subject: [PATCH 10/11] Fix Null pointer deref in X509_issuer_and_serial_hash()

The OpenSSL public API function X509_issuer_and_serial_hash() attempts
to create a unique hash value based on the issuer and serial number data
contained within an X509 certificate. However it fails to correctly
handle any errors that may occur while parsing the issuer field (which
might occur if the issuer field is maliciously constructed). This may
subsequently result in a NULL pointer deref and a crash leading to a
potential denial of service attack.

The function X509_issuer_and_serial_hash() is never directly called by
OpenSSL itself so applications are only vulnerable if they use this
function directly and they use it on certificates that may have been
obtained from untrusted sources.

CVE-2021-23841

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(cherry picked from commit 8130d654d1de922ea224fa18ee3bc7262edc39c0)
(cherry picked from commit 122a19ab48091c657f7cb1fb3af9fc07bd557bbf)
---
 crypto/x509/x509_cmp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/crypto/x509/x509_cmp.c b/crypto/x509/x509_cmp.c
index a7b90e6a42..62868f0c9c 100644
--- a/crypto/x509/x509_cmp.c
+++ b/crypto/x509/x509_cmp.c
@@ -87,6 +87,8 @@ unsigned long X509_issuer_and_serial_hash(X509 *a)
 
     EVP_MD_CTX_init(&ctx);
     f = X509_NAME_oneline(a->cert_info->issuer, NULL, 0);
+    if (f == NULL)
+        goto err;
     if (!EVP_DigestInit_ex(&ctx, EVP_md5(), NULL))
         goto err;
     if (!EVP_DigestUpdate(&ctx, (unsigned char *)f, strlen(f)))
-- 
2.53.0

openSUSE Build Service is sponsored by