summaryrefslogtreecommitdiffstats
path: root/net/base
diff options
context:
space:
mode:
authorwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-16 00:59:56 +0000
committerwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-16 00:59:56 +0000
commitdbc13b5d232666808a29e0e787883f06082282fd (patch)
tree54e9c83e9f0431345b29ae64a7ecc01146140fae /net/base
parent0bbd6db7289b9b9337203715fd8d037f975bd044 (diff)
downloadchromium_src-dbc13b5d232666808a29e0e787883f06082282fd.zip
chromium_src-dbc13b5d232666808a29e0e787883f06082282fd.tar.gz
chromium_src-dbc13b5d232666808a29e0e787883f06082282fd.tar.bz2
Do not call NSS functions if NSS initialization failed.
R=agl BUG=36071 TEST=none Review URL: http://codereview.chromium.org/1545034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44728 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r--net/base/x509_certificate_nss.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/base/x509_certificate_nss.cc b/net/base/x509_certificate_nss.cc
index 976435d..e311edb 100644
--- a/net/base/x509_certificate_nss.cc
+++ b/net/base/x509_certificate_nss.cc
@@ -5,6 +5,7 @@
#include "net/base/x509_certificate.h"
#include <cert.h>
+#include <nss.h>
#include <pk11pub.h>
#include <prerror.h>
#include <prtime.h>
@@ -722,6 +723,9 @@ X509Certificate::OSCertHandle X509Certificate::CreateOSCertHandleFromBytes(
const char* data, int length) {
base::EnsureNSSInit();
+ if (!NSS_IsInitialized())
+ return NULL;
+
// Make a copy of |data| since CERT_DecodeCertPackage might modify it.
char* data_copy = new char[length];
memcpy(data_copy, data, length);