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

Unified Diff: net/http/http_security_headers.cc

Issue 86043003: net: don't duplicate HPKP hashes when parsing the header. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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/http/http_security_headers_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_security_headers.cc
diff --git a/net/http/http_security_headers.cc b/net/http/http_security_headers.cc
index 9fc7627cc5e0c676c3461ad4a8340145d5d00ca3..0c3305f6e42731711cd3f77d0f2162e79a571fd6 100644
--- a/net/http/http_security_headers.cc
+++ b/net/http/http_security_headers.cc
@@ -325,7 +325,18 @@ bool ParseHPKPHeader(const std::string& value,
*include_subdomains = include_subdomains_candidate;
for (HashValueVector::const_iterator i = pins.begin();
i != pins.end(); ++i) {
- hashes->push_back(*i);
+ bool found = false;
+
+ for (HashValueVector::const_iterator j = hashes->begin();
+ j != hashes->end(); ++j) {
+ if (j->Equals(*i)) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found)
+ hashes->push_back(*i);
}
return true;
« no previous file with comments | « no previous file | net/http/http_security_headers_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698