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

Unified Diff: net/cert/x509_certificate_nss.cc

Issue 2758803003: Make X509Certificate creation fail if X509Certificate::Initialize fails. (Closed)
Patch Set: test updatess 2 Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/cert/x509_certificate_mac.cc ('k') | net/cert/x509_certificate_openssl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/x509_certificate_nss.cc
diff --git a/net/cert/x509_certificate_nss.cc b/net/cert/x509_certificate_nss.cc
index baa0a5953c4a9c77088d8da17ed9be653057e5c3..4f3339f6a62c8b4ce5f717d5b2ef124872a6e54d 100644
--- a/net/cert/x509_certificate_nss.cc
+++ b/net/cert/x509_certificate_nss.cc
@@ -26,14 +26,15 @@
namespace net {
-void X509Certificate::Initialize() {
- x509_util::ParsePrincipal(&cert_handle_->subject, &subject_);
- x509_util::ParsePrincipal(&cert_handle_->issuer, &issuer_);
-
- x509_util::ParseDate(&cert_handle_->validity.notBefore, &valid_start_);
- x509_util::ParseDate(&cert_handle_->validity.notAfter, &valid_expiry_);
-
+bool X509Certificate::Initialize() {
serial_number_ = x509_util::ParseSerialNumber(cert_handle_);
+
+ return (
+ !serial_number_.empty() &&
+ x509_util::ParsePrincipal(&cert_handle_->subject, &subject_) &&
+ x509_util::ParsePrincipal(&cert_handle_->issuer, &issuer_) &&
+ x509_util::ParseDate(&cert_handle_->validity.notBefore, &valid_start_) &&
+ x509_util::ParseDate(&cert_handle_->validity.notAfter, &valid_expiry_));
}
std::string X509Certificate::GetDefaultNickname(CertType type) const {
« no previous file with comments | « net/cert/x509_certificate_mac.cc ('k') | net/cert/x509_certificate_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698