From: Joe Orton Date: Mon, 6 Jul 2026 12:08:49 +0000 (+0000) Subject: * modules/ssl/ssl_util.c (ssl_asn1_table_set): Add assertion X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4f8722996978bf8e74bb206a3b13d189a2792a0a;p=thirdparty%2Fapache%2Fhttpd.git * modules/ssl/ssl_util.c (ssl_asn1_table_set): Add assertion for the (likely unreachable) i2d_PrivateKey() failure case. Submitted by: Sayed Kaif Github: closes #619 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1935941 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/ssl/ssl_util.c b/modules/ssl/ssl_util.c index 12ffff511e..cf28968233 100644 --- a/modules/ssl/ssl_util.c +++ b/modules/ssl/ssl_util.c @@ -201,9 +201,13 @@ ssl_asn1_t *ssl_asn1_table_set(apr_hash_t *table, const char *key, { apr_ssize_t klen = strlen(key); ssl_asn1_t *asn1 = apr_hash_get(table, key, klen); - apr_size_t length = i2d_PrivateKey(pkey, NULL); + int derlen = i2d_PrivateKey(pkey, NULL); + apr_size_t length; unsigned char *p; + ap_assert(derlen > 0); /* should never happen for any loaded key */ + length = (apr_size_t)derlen; + /* Re-use structure if cached previously. */ if (asn1) { if (asn1->nData != length) {