Skip to content

Commit 4f87229

Browse files
committed
* modules/ssl/ssl_util.c (ssl_asn1_table_set): Add assertion
for the (likely unreachable) i2d_PrivateKey() failure case. Submitted by: Sayed Kaif <metsw24 gmail.com> Github: closes #619 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1935941 13f79535-47bb-0310-9956-ffa450edef68
1 parent 2ac25f0 commit 4f87229

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

modules/ssl/ssl_util.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,13 @@ ssl_asn1_t *ssl_asn1_table_set(apr_hash_t *table, const char *key,
201201
{
202202
apr_ssize_t klen = strlen(key);
203203
ssl_asn1_t *asn1 = apr_hash_get(table, key, klen);
204-
apr_size_t length = i2d_PrivateKey(pkey, NULL);
204+
int derlen = i2d_PrivateKey(pkey, NULL);
205+
apr_size_t length;
205206
unsigned char *p;
206207

208+
ap_assert(derlen > 0); /* should never happen for any loaded key */
209+
length = (apr_size_t)derlen;
210+
207211
/* Re-use structure if cached previously. */
208212
if (asn1) {
209213
if (asn1->nData != length) {

0 commit comments

Comments
 (0)