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

Unified Diff: net/base/crl_set.cc

Issue 8381017: net: retain leading zero bytes in X.509 serial numbers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 9 years, 2 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 | « no previous file | net/base/x509_certificate.h » ('j') | net/base/x509_certificate.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/crl_set.cc
diff --git a/net/base/crl_set.cc b/net/base/crl_set.cc
index 5b28be752d9ec3e345120e3ebabe7aeeac110af6..b76fd87e0b52422bc7178bd6f87466369de0b119 100644
--- a/net/base/crl_set.cc
+++ b/net/base/crl_set.cc
@@ -408,6 +408,18 @@ bool CRLSet::ApplyDelta(base::StringPiece data,
CRLSet::Result CRLSet::CheckCertificate(
const base::StringPiece& serial_number,
const base::StringPiece& parent_spki) const {
+ base::StringPiece serial(serial_number);
+
+ if (!serial.empty() && serial[0] >= 0x80) {
+ // This serial number is negative but the process which generates CRL sets
+ // will reject any certificates with negative serial numbers as invalid.
+ return UNKNOWN;
+ }
+
+ // Remove any leading zero bytes.
+ while (!serial.empty() && serial[0] == 0x00)
wtc 2011/10/25 21:14:44 BUG(?): !serial.empty() => serial.size() > 1 to av
agl 2011/10/28 20:29:07 Done.
+ serial.remove_prefix(1);
+
std::map<std::string, size_t>::const_iterator i =
crls_index_by_issuer_.find(parent_spki.as_string());
if (i == crls_index_by_issuer_.end())
« no previous file with comments | « no previous file | net/base/x509_certificate.h » ('j') | net/base/x509_certificate.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698