svn commit: r1935926 - httpd/httpd/trunk/modules/md

[email protected] Mon, 06 Jul 2026 08:15:14 -0000
Newsgroups gmane.comp.apache.cvs
Message-ID <178332571487.346665.15747038763985739113@svn03-he-fi>
Author: jorton
Date: Mon Jul  6 08:15:14 2026
New Revision: 1935926

Log:
* modules/md/md_crypt.c (md_cert_get_ari_cert_id):
  Don't used fixed buffer size for serial number,
  fail if ASN.1->BIGNUM conversion fails.

Github: closes #680

Modified:
   httpd/httpd/trunk/modules/md/md_crypt.c

Modified: httpd/httpd/trunk/modules/md/md_crypt.c
==============================================================================
--- httpd/httpd/trunk/modules/md/md_crypt.c	Mon Jul  6 07:19:53 2026	(r1935925)
+++ httpd/httpd/trunk/modules/md/md_crypt.c	Mon Jul  6 08:15:14 2026	(r1935926)
@@ -2226,7 +2226,7 @@ apr_status_t md_cert_get_ari_cert_id(con
     const ASN1_INTEGER *serial;
     BIGNUM *bn;
     int i = -1, sder_len;
-    unsigned char *ucp, sbuf[256];
+    unsigned char *ucp, *sbuf;
 
     *pari_cert_id = NULL;
     s_aki = X509_get_ext_d2i(cert->x509, NID_authority_key_identifier, &i, NULL);
@@ -2253,6 +2253,10 @@ apr_status_t md_cert_get_ari_cert_id(con
     }
     memset(&ser_buf, 0, sizeof(ser_buf));
     bn = ASN1_INTEGER_to_BN(serial, NULL);
+    if (!bn) {
+        return APR_EINVAL;
+    }
+    sbuf = apr_pcalloc(p, BN_num_bytes(bn));
     sder_len = BN_bn2bin(bn, sbuf);
     BN_free(bn);
     if (sder_len < 1)