mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
Check CA certificate in curl_darwinssl.c.
SecCertificateCreateWithData() returns a non-NULL SecCertificateRef even if the buffer holds an invalid or corrupt certificate. Call SecCertificateCopyPublicKey() to make sure cacert is a valid certificate.
This commit is contained in:
parent
4c134bcfce
commit
0426670f0a
@ -1671,6 +1671,16 @@ static int append_cert_to_array(struct SessionHandle *data,
|
||||
return CURLE_SSL_CACERT;
|
||||
}
|
||||
|
||||
/* Check if cacert is valid. */
|
||||
SecKeyRef key;
|
||||
OSStatus ret = SecCertificateCopyPublicKey(cacert, &key);
|
||||
if(ret != noErr) {
|
||||
CFRelease(cacert);
|
||||
failf(data, "SSL: invalid CA certificate");
|
||||
return CURLE_SSL_CACERT;
|
||||
}
|
||||
CFRelease(key);
|
||||
|
||||
CFArrayAppendValue(array, cacert);
|
||||
CFRelease(cacert);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user