Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Pouliot <sebastien@xamarin.com>2013-04-30 01:44:07 +0400
committerSebastien Pouliot <sebastien@xamarin.com>2013-04-30 01:44:39 +0400
commit7cd961939c9495362d619d8636366033253fc3ee (patch)
tree535a9aa3ba6946cffaf9fe455196529e95b1d73d /mcs/class/System/System.Security.Cryptography.X509Certificates
parent5543285e68a10f40de170dfbf17b6736acdad528 (diff)
Avoid potential NRE is the UserCAStore could not be created. ref: desk #33432
Diffstat (limited to 'mcs/class/System/System.Security.Cryptography.X509Certificates')
-rw-r--r--mcs/class/System/System.Security.Cryptography.X509Certificates/X509Chain.cs14
1 files changed, 9 insertions, 5 deletions
diff --git a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Chain.cs b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Chain.cs
index 99f40f4d0c1..7dfd434c85a 100644
--- a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Chain.cs
+++ b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Chain.cs
@@ -878,8 +878,12 @@ namespace System.Security.Cryptography.X509Certificates {
return X509ChainStatusFlags.NoError;
}
- static MX.X509Crl CheckCrls (string subject, string ski, ArrayList crls)
+ static MX.X509Crl CheckCrls (string subject, string ski, MX.X509Store store)
{
+ if (store == null)
+ return null;
+
+ var crls = store.Crls;
foreach (MX.X509Crl crl in crls) {
if (crl.IssuerName == subject && (ski.Length == 0 || ski == GetAuthorityKeyIdentifier (crl)))
return crl;
@@ -893,21 +897,21 @@ namespace System.Security.Cryptography.X509Certificates {
string ski = GetSubjectKeyIdentifier (caCertificate);
// consider that the LocalMachine directories could not exists... and cannot be created by the user
- var result = (LMCAStore.Store == null) ? null : CheckCrls (subject, ski, LMCAStore.Store.Crls);
+ MX.X509Crl result = CheckCrls (subject, ski, LMCAStore.Store);
if (result != null)
return result;
if (location == StoreLocation.CurrentUser) {
- result = CheckCrls (subject, ski, UserCAStore.Store.Crls);
+ result = CheckCrls (subject, ski, UserCAStore.Store);
if (result != null)
return result;
}
// consider that the LocalMachine directories could not exists... and cannot be created by the user
- result = (LMRootStore.Store == null) ? null : CheckCrls (subject, ski, LMRootStore.Store.Crls);
+ result = CheckCrls (subject, ski, LMRootStore.Store);
if (result != null)
return result;
if (location == StoreLocation.CurrentUser) {
- result = CheckCrls (subject, ski, UserRootStore.Store.Crls);
+ result = CheckCrls (subject, ski, UserRootStore.Store);
if (result != null)
return result;
}