Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: net/cert/x509_util_mac.cc

Issue 2820183002: Mac: Fix crash in CreateSecCertificateArrayForX509Certificate. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/cert/x509_util_mac.h" 5 #include "net/cert/x509_util_mac.h"
6 6
7 #include <CommonCrypto/CommonDigest.h> 7 #include <CommonCrypto/CommonDigest.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 CreateSecCertificateFromBytes(CRYPTO_BUFFER_data(cert->os_cert_handle()), 104 CreateSecCertificateFromBytes(CRYPTO_BUFFER_data(cert->os_cert_handle()),
105 CRYPTO_BUFFER_len(cert->os_cert_handle()))); 105 CRYPTO_BUFFER_len(cert->os_cert_handle())));
106 if (!sec_cert) 106 if (!sec_cert)
107 return base::ScopedCFTypeRef<CFMutableArrayRef>(); 107 return base::ScopedCFTypeRef<CFMutableArrayRef>();
108 CFArrayAppendValue(cert_list, sec_cert); 108 CFArrayAppendValue(cert_list, sec_cert);
109 for (X509Certificate::OSCertHandle intermediate : 109 for (X509Certificate::OSCertHandle intermediate :
110 cert->GetIntermediateCertificates()) { 110 cert->GetIntermediateCertificates()) {
111 base::ScopedCFTypeRef<SecCertificateRef> sec_cert( 111 base::ScopedCFTypeRef<SecCertificateRef> sec_cert(
112 CreateSecCertificateFromBytes(CRYPTO_BUFFER_data(intermediate), 112 CreateSecCertificateFromBytes(CRYPTO_BUFFER_data(intermediate),
113 CRYPTO_BUFFER_len(intermediate))); 113 CRYPTO_BUFFER_len(intermediate)));
114 if (!sec_cert)
115 return base::ScopedCFTypeRef<CFMutableArrayRef>();
114 CFArrayAppendValue(cert_list, sec_cert); 116 CFArrayAppendValue(cert_list, sec_cert);
115 } 117 }
116 #else 118 #else
117 X509Certificate::OSCertHandles intermediate_ca_certs = 119 X509Certificate::OSCertHandles intermediate_ca_certs =
118 cert->GetIntermediateCertificates(); 120 cert->GetIntermediateCertificates();
119 CFArrayAppendValue(cert_list, cert->os_cert_handle()); 121 CFArrayAppendValue(cert_list, cert->os_cert_handle());
120 for (size_t i = 0; i < intermediate_ca_certs.size(); ++i) 122 for (size_t i = 0; i < intermediate_ca_certs.size(); ++i)
121 CFArrayAppendValue(cert_list, intermediate_ca_certs[i]); 123 CFArrayAppendValue(cert_list, intermediate_ca_certs[i]);
122 #endif 124 #endif
123 return cert_list; 125 return cert_list;
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 CSSM_CL_CertAbortQuery(cl_handle_, results_handle); 412 CSSM_CL_CertAbortQuery(cl_handle_, results_handle);
411 field->Reset(cl_handle_, oid, field_ptr); 413 field->Reset(cl_handle_, oid, field_ptr);
412 return CSSM_OK; 414 return CSSM_OK;
413 } 415 }
414 416
415 } // namespace x509_util 417 } // namespace x509_util
416 418
417 #pragma clang diagnostic pop // "-Wdeprecated-declarations" 419 #pragma clang diagnostic pop // "-Wdeprecated-declarations"
418 420
419 } // namespace net 421 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698