summaryrefslogtreecommitdiffstats
path: root/security/manager/ssl/nsNSSCertificate.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-11-02 02:08:44 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-11-02 02:08:44 +0100
commit52b989d53553949c82e999b86e24f824e55bafbb (patch)
tree88ef201f67290ebeb697eb99919a73525c635d53 /security/manager/ssl/nsNSSCertificate.cpp
parent059397bdd2b8eaaa7f2bbacb9ce415aba8db91b0 (diff)
downloadUXP-52b989d53553949c82e999b86e24f824e55bafbb.tar
UXP-52b989d53553949c82e999b86e24f824e55bafbb.tar.gz
UXP-52b989d53553949c82e999b86e24f824e55bafbb.tar.lz
UXP-52b989d53553949c82e999b86e24f824e55bafbb.tar.xz
UXP-52b989d53553949c82e999b86e24f824e55bafbb.zip
Make sure nsNSSCertList handling checks for valid certs.
Diffstat (limited to 'security/manager/ssl/nsNSSCertificate.cpp')
-rw-r--r--security/manager/ssl/nsNSSCertificate.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/security/manager/ssl/nsNSSCertificate.cpp b/security/manager/ssl/nsNSSCertificate.cpp
index 12fca5065..f6685e89a 100644
--- a/security/manager/ssl/nsNSSCertificate.cpp
+++ b/security/manager/ssl/nsNSSCertificate.cpp
@@ -1208,6 +1208,10 @@ void nsNSSCertList::destructorSafeDestroyNSSReference()
NS_IMETHODIMP
nsNSSCertList::AddCert(nsIX509Cert* aCert)
{
+ if (!aCert) {
+ return NS_ERROR_INVALID_ARG;
+ }
+
nsNSSShutDownPreventionLock locker;
if (isAlreadyShutDown()) {
return NS_ERROR_NOT_AVAILABLE;
@@ -1369,17 +1373,20 @@ nsNSSCertList::Read(nsIObjectInputStream* aStream)
nsCOMPtr<nsISupports> certSupports;
rv = aStream->ReadObject(true, getter_AddRefs(certSupports));
if (NS_FAILED(rv)) {
- break;
+ return rv;
}
nsCOMPtr<nsIX509Cert> cert = do_QueryInterface(certSupports);
+ if (!cert) {
+ return NS_ERROR_UNEXPECTED;
+ }
rv = AddCert(cert);
if (NS_FAILED(rv)) {
- break;
+ return rv;
}
}
- return rv;
+ return NS_OK;
}
NS_IMETHODIMP