diff options
author | ppi@chromium.org <ppi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-17 15:02:03 +0000 |
---|---|---|
committer | ppi@chromium.org <ppi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-17 15:02:03 +0000 |
commit | 7e740a05dfb9cf0ebe579c2d4b8cf1b054040cf1 (patch) | |
tree | 6792a43ebebbe9ae07e289084f726aa5f07a6392 | |
parent | 343da0347814993ca906da7017e072306ed7d22c (diff) | |
download | chromium_src-7e740a05dfb9cf0ebe579c2d4b8cf1b054040cf1.zip chromium_src-7e740a05dfb9cf0ebe579c2d4b8cf1b054040cf1.tar.gz chromium_src-7e740a05dfb9cf0ebe579c2d4b8cf1b054040cf1.tar.bz2 |
Improve CertVerifyProcOpenSSL robustness against malicious data
This patch allows OpenSSL certificate verification to fail gracefully when
preliminary initialization step fails, rather than crashing the browser.
BUG=165858
Review URL: https://chromiumcodereview.appspot.com/11572060
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173459 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | net/base/cert_verify_proc_openssl.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/net/base/cert_verify_proc_openssl.cc b/net/base/cert_verify_proc_openssl.cc index 122c7b4..b9cd0b1 100644 --- a/net/base/cert_verify_proc_openssl.cc +++ b/net/base/cert_verify_proc_openssl.cc @@ -188,9 +188,11 @@ int CertVerifyProcOpenSSL::VerifyInternal(X509Certificate* cert, if (!sk_X509_push(intermediates.get(), *it)) return ERR_OUT_OF_MEMORY; } - int rv = X509_STORE_CTX_init(ctx.get(), X509Certificate::cert_store(), - cert->os_cert_handle(), intermediates.get()); - CHECK_EQ(1, rv); + if (X509_STORE_CTX_init(ctx.get(), X509Certificate::cert_store(), + cert->os_cert_handle(), intermediates.get()) != 1) { + NOTREACHED(); + return ERR_FAILED; + } if (X509_verify_cert(ctx.get()) != 1) { int x509_error = X509_STORE_CTX_get_error(ctx.get()); |