mirror of
https://github.com/apache/httpd.git
synced 2025-08-07 04:02:58 +03:00
mod_ssl uses free() inappropriately in several places, to free
memory which has been previously allocated inside OpenSSL. Such memory should be freed with OPENSSL_free(), not with free(). Submitted by: Nadav Har'El <nyh@math.technion.ac.il>, Madhusudan Mathihalli <madhusudan_mathihalli@hp.com> Reviewed by: Jeff Trawick git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@97307 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
6
CHANGES
6
CHANGES
@@ -1,5 +1,11 @@
|
|||||||
Changes with Apache 2.0.44
|
Changes with Apache 2.0.44
|
||||||
|
|
||||||
|
*) mod_ssl uses free() inappropriately in several places, to free
|
||||||
|
memory which has been previously allocated inside OpenSSL.
|
||||||
|
Such memory should be freed with OPENSSL_free(), not with free().
|
||||||
|
[Nadav Har'El <nyh@math.technion.ac.il>,
|
||||||
|
Madhusudan Mathihalli <madhusudan_mathihalli@hp.com>].
|
||||||
|
|
||||||
*) Emit a message to the error log when we return 404 because
|
*) Emit a message to the error log when we return 404 because
|
||||||
the URI contained '%2f'. (This was previously nastily silent
|
the URI contained '%2f'. (This was previously nastily silent
|
||||||
and difficult to debug.) [Ken Coar]
|
and difficult to debug.) [Ken Coar]
|
||||||
|
@@ -968,7 +968,7 @@ int ssl_hook_UserCheck(request_rec *r)
|
|||||||
X509_NAME *name = X509_get_subject_name(sslconn->client_cert);
|
X509_NAME *name = X509_get_subject_name(sslconn->client_cert);
|
||||||
char *cp = X509_NAME_oneline(name, NULL, 0);
|
char *cp = X509_NAME_oneline(name, NULL, 0);
|
||||||
sslconn->client_dn = apr_pstrdup(r->connection->pool, cp);
|
sslconn->client_dn = apr_pstrdup(r->connection->pool, cp);
|
||||||
free(cp);
|
modssl_free(cp);
|
||||||
}
|
}
|
||||||
|
|
||||||
clientdn = (char *)sslconn->client_dn;
|
clientdn = (char *)sslconn->client_dn;
|
||||||
@@ -1299,11 +1299,11 @@ int ssl_callback_SSLVerify(int ok, X509_STORE_CTX *ctx)
|
|||||||
iname ? iname : "-unknown-");
|
iname ? iname : "-unknown-");
|
||||||
|
|
||||||
if (sname) {
|
if (sname) {
|
||||||
free(sname);
|
modssl_free(sname);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iname) {
|
if (iname) {
|
||||||
free(iname);
|
modssl_free(iname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1555,7 +1555,7 @@ int ssl_callback_SSLVerify_CRL(int ok, X509_STORE_CTX *ctx, conn_rec *c)
|
|||||||
"Certificate with serial %ld (0x%lX) "
|
"Certificate with serial %ld (0x%lX) "
|
||||||
"revoked per CRL from issuer %s",
|
"revoked per CRL from issuer %s",
|
||||||
serial, serial, cp);
|
serial, serial, cp);
|
||||||
free(cp);
|
modssl_free(cp);
|
||||||
}
|
}
|
||||||
|
|
||||||
X509_STORE_CTX_set_error(ctx, X509_V_ERR_CERT_REVOKED);
|
X509_STORE_CTX_set_error(ctx, X509_V_ERR_CERT_REVOKED);
|
||||||
@@ -1593,6 +1593,7 @@ static void modssl_proxy_info_log(server_rec *s,
|
|||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
||||||
SSLPROXY_CERT_CB_LOG_FMT "%s, sending %s",
|
SSLPROXY_CERT_CB_LOG_FMT "%s, sending %s",
|
||||||
sc->vhost_id, msg, dn ? dn : "-uknown-");
|
sc->vhost_id, msg, dn ? dn : "-uknown-");
|
||||||
|
modssl_free(dn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -334,7 +334,7 @@ static char *ssl_var_lookup_ssl_cert(apr_pool_t *p, X509 *xs, char *var)
|
|||||||
xsname = X509_get_subject_name(xs);
|
xsname = X509_get_subject_name(xs);
|
||||||
cp = X509_NAME_oneline(xsname, NULL, 0);
|
cp = X509_NAME_oneline(xsname, NULL, 0);
|
||||||
result = apr_pstrdup(p, cp);
|
result = apr_pstrdup(p, cp);
|
||||||
free(cp);
|
modssl_free(cp);
|
||||||
resdup = FALSE;
|
resdup = FALSE;
|
||||||
}
|
}
|
||||||
else if (strlen(var) > 5 && strcEQn(var, "S_DN_", 5)) {
|
else if (strlen(var) > 5 && strcEQn(var, "S_DN_", 5)) {
|
||||||
@@ -346,7 +346,7 @@ static char *ssl_var_lookup_ssl_cert(apr_pool_t *p, X509 *xs, char *var)
|
|||||||
xsname = X509_get_issuer_name(xs);
|
xsname = X509_get_issuer_name(xs);
|
||||||
cp = X509_NAME_oneline(xsname, NULL, 0);
|
cp = X509_NAME_oneline(xsname, NULL, 0);
|
||||||
result = apr_pstrdup(p, cp);
|
result = apr_pstrdup(p, cp);
|
||||||
free(cp);
|
modssl_free(cp);
|
||||||
resdup = FALSE;
|
resdup = FALSE;
|
||||||
}
|
}
|
||||||
else if (strlen(var) > 5 && strcEQn(var, "I_DN_", 5)) {
|
else if (strlen(var) > 5 && strcEQn(var, "I_DN_", 5)) {
|
||||||
|
@@ -105,6 +105,8 @@
|
|||||||
|
|
||||||
#define modssl_set_cipher_list SSL_set_cipher_list
|
#define modssl_set_cipher_list SSL_set_cipher_list
|
||||||
|
|
||||||
|
#define modssl_free OPENSSL_free
|
||||||
|
|
||||||
#define EVP_PKEY_reference_inc(pkey) \
|
#define EVP_PKEY_reference_inc(pkey) \
|
||||||
CRYPTO_add(&((pkey)->references), +1, CRYPTO_LOCK_X509_PKEY)
|
CRYPTO_add(&((pkey)->references), +1, CRYPTO_LOCK_X509_PKEY)
|
||||||
|
|
||||||
@@ -148,6 +150,8 @@
|
|||||||
#define modssl_set_cipher_list(ssl, l) \
|
#define modssl_set_cipher_list(ssl, l) \
|
||||||
SSL_set_cipher_list(ssl, (char *)l)
|
SSL_set_cipher_list(ssl, (char *)l)
|
||||||
|
|
||||||
|
#define modssl_free free
|
||||||
|
|
||||||
#ifndef PEM_F_DEF_CALLBACK
|
#ifndef PEM_F_DEF_CALLBACK
|
||||||
#define PEM_F_DEF_CALLBACK PEM_F_DEF_CB
|
#define PEM_F_DEF_CALLBACK PEM_F_DEF_CB
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user