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

Unified Diff: net/cert/x509_cert_types.cc

Issue 1832583002: Don't allow negative date components in ParseCertificateDate(), or ones starting with a plus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@parse_num
Patch Set: moar test Created 4 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 | « no previous file | net/cert/x509_cert_types_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/x509_cert_types.cc
diff --git a/net/cert/x509_cert_types.cc b/net/cert/x509_cert_types.cc
index bfb875cf56c138868996097013b1451c59713598..766a1f0429b3a6add189dc7ba5065d5e5cd982b8 100644
--- a/net/cert/x509_cert_types.cc
+++ b/net/cert/x509_cert_types.cc
@@ -8,9 +8,9 @@
#include <cstring>
#include "base/logging.h"
-#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
#include "base/time/time.h"
+#include "net/base/parse_number.h"
#include "net/cert/x509_certificate.h"
namespace net {
@@ -23,7 +23,8 @@ namespace {
// untouched otherwise. Returns the parsed integer.
int ParseIntAndAdvance(const char** field, size_t field_len, bool* ok) {
int result = 0;
- *ok &= base::StringToInt(base::StringPiece(*field, field_len), &result);
+ *ok &=
+ ParseNonNegativeDecimalInt(base::StringPiece(*field, field_len), &result);
*field += field_len;
return result;
}
« no previous file with comments | « no previous file | net/cert/x509_cert_types_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698