mirror of
https://github.com/curl/curl.git
synced 2026-08-11 06:10:54 +03:00
openssl: fail if more than MAX_ALLOWED_CERT_AMOUNT certs
Detect and prevent abuse or mistakes. Limit set to 100. Closes #19091
This commit is contained in:
parent
f221cdeabe
commit
3df71e6dc2
1 changed files with 7 additions and 0 deletions
|
|
@ -349,6 +349,8 @@ static CURLcode X509V3_ext(struct Curl_easy *data,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define MAX_ALLOWED_CERT_AMOUNT 100
|
||||||
|
|
||||||
static CURLcode ossl_certchain(struct Curl_easy *data, SSL *ssl)
|
static CURLcode ossl_certchain(struct Curl_easy *data, SSL *ssl)
|
||||||
{
|
{
|
||||||
CURLcode result;
|
CURLcode result;
|
||||||
|
|
@ -364,6 +366,11 @@ static CURLcode ossl_certchain(struct Curl_easy *data, SSL *ssl)
|
||||||
return CURLE_SSL_CONNECT_ERROR;
|
return CURLE_SSL_CONNECT_ERROR;
|
||||||
|
|
||||||
numcerts = sk_X509_num(sk);
|
numcerts = sk_X509_num(sk);
|
||||||
|
if(numcerts > MAX_ALLOWED_CERT_AMOUNT) {
|
||||||
|
failf(data, "%d certificates is more than allowed (%u)", (int)numcerts,
|
||||||
|
MAX_ALLOWED_CERT_AMOUNT);
|
||||||
|
return CURLE_SSL_CONNECT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
result = Curl_ssl_init_certinfo(data, (int)numcerts);
|
result = Curl_ssl_init_certinfo(data, (int)numcerts);
|
||||||
if(result)
|
if(result)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue