diff options
author | Patrick Monnerat <patrick@monnerat.net> | 2016-11-24 14:28:39 +0100 |
---|---|---|
committer | Patrick Monnerat <patrick@monnerat.net> | 2016-11-24 14:28:39 +0100 |
commit | 945f60e8a7f08aedb0eede5e3574f1972fc86ec8 (patch) | |
tree | 6a3479b7bdaf88a17f4f915846c1fddaff73873a /lib/vtls | |
parent | 3e9c0230f45cafb9154bb4fcdc8ff2b51f00701a (diff) |
Limit ASN.1 structure sizes to 256K. Prevent some allocation size overflows.
See CRL-01-006.
Diffstat (limited to 'lib/vtls')
-rw-r--r-- | lib/vtls/cyassl.c | 3 | ||||
-rw-r--r-- | lib/vtls/gskit.c | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/vtls/cyassl.c b/lib/vtls/cyassl.c index 39248d2c7..f0c0f4a07 100644 --- a/lib/vtls/cyassl.c +++ b/lib/vtls/cyassl.c @@ -512,7 +512,8 @@ cyassl_connect_step2(struct connectdata *conn, } memset(&x509_parsed, 0, sizeof x509_parsed); - Curl_parseX509(&x509_parsed, x509_der, x509_der + x509_der_len); + if(Curl_parseX509(&x509_parsed, x509_der, x509_der + x509_der_len)) + return CURLE_SSL_PINNEDPUBKEYNOTMATCH; pubkey = &x509_parsed.subjectPublicKeyInfo; if(!pubkey->header || pubkey->end <= pubkey->header) { diff --git a/lib/vtls/gskit.c b/lib/vtls/gskit.c index e1dd9b6b0..2ccb9e47b 100644 --- a/lib/vtls/gskit.c +++ b/lib/vtls/gskit.c @@ -875,9 +875,8 @@ static CURLcode gskit_connect_step3(struct connectdata *conn, int sockindex) curl_X509certificate x509; curl_asn1Element *p; - if(!cert) + if(Curl_parseX509(&x509, cert, certend)) return CURLE_SSL_PINNEDPUBKEYNOTMATCH; - Curl_parseX509(&x509, cert, certend); p = &x509.subjectPublicKeyInfo; result = Curl_pin_peer_pubkey(data, ptr, p->header, p->end - p->header); if(result) { |