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

Unified Diff: net/base/registry_controlled_domains/registry_controlled_domain.cc

Issue 2784933002: Mitigate spoofing attempt using Latin letters. (Closed)
Patch Set: add similarity check unittests 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 side-by-side diff with in-line comments
Download patch
Index: net/base/registry_controlled_domains/registry_controlled_domain.cc
diff --git a/net/base/registry_controlled_domains/registry_controlled_domain.cc b/net/base/registry_controlled_domains/registry_controlled_domain.cc
index 3777582812bb7103d4062d13a22a53ad342aac8e..615a1f230d728c38c9cc5ecf8a69fbf094d87e12 100644
--- a/net/base/registry_controlled_domains/registry_controlled_domain.cc
+++ b/net/base/registry_controlled_domains/registry_controlled_domain.cc
@@ -46,9 +46,9 @@
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "base/logging.h"
+#include "base/lookup_string_in_fixed_set.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
-#include "net/base/lookup_string_in_fixed_set.h"
#include "net/base/net_module.h"
#include "net/base/url_util.h"
#include "url/gurl.h"
@@ -107,10 +107,10 @@ size_t GetRegistryLengthImpl(base::StringPiece host,
while (1) {
const char* domain_str = host.data() + curr_start;
size_t domain_length = host_check_len - curr_start;
- int type = LookupStringInFixedSet(g_graph, g_graph_length, domain_str,
- domain_length);
- bool do_check = type != kDafsaNotFound &&
- (!(type & kDafsaPrivateRule) ||
+ int type = base::LookupStringInFixedSet(g_graph, g_graph_length, domain_str,
+ domain_length);
+ bool do_check = type != base::kDafsaNotFound &&
+ (!(type & base::kDafsaPrivateRule) ||
private_filter == INCLUDE_PRIVATE_REGISTRIES);
// If the apparent match is a private registry and we're not including
@@ -118,14 +118,15 @@ size_t GetRegistryLengthImpl(base::StringPiece host,
if (do_check) {
// Exception rules override wildcard rules when the domain is an exact
// match, but wildcards take precedence when there's a subdomain.
- if (type & kDafsaWildcardRule && (prev_start != std::string::npos)) {
+ if (type & base::kDafsaWildcardRule &&
+ (prev_start != std::string::npos)) {
// If prev_start == host_check_begin, then the host is the registry
// itself, so return 0.
return (prev_start == host_check_begin) ? 0
: (host.length() - prev_start);
}
- if (type & kDafsaExceptionRule) {
+ if (type & base::kDafsaExceptionRule) {
if (next_dot == std::string::npos) {
// If we get here, we had an exception rule with no dots (e.g.
// "!foo"). This would only be valid if we had a corresponding

Powered by Google App Engine
This is Rietveld 408576698