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

Unified Diff: net/dns/dns_hosts.cc

Issue 2294343003: Refuse to resolve some types of invalid DNS addresses. (Closed)
Patch Set: Oops Created 4 years, 3 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/dns/dns_hosts_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/dns_hosts.cc
diff --git a/net/dns/dns_hosts.cc b/net/dns/dns_hosts.cc
index 098c6172511ce5f095105bb9c9017db112b3476c..568a9ce5558c0f12d05242371314c7789ff5157a 100644
--- a/net/dns/dns_hosts.cc
+++ b/net/dns/dns_hosts.cc
@@ -9,6 +9,7 @@
#include "base/macros.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_util.h"
+#include "net/dns/dns_util.h"
using base::StringPiece;
@@ -155,6 +156,8 @@ void ParseHostsWithCommaMode(const std::string& contents,
}
} else {
DnsHostsKey key(parser.token().as_string(), family);
+ if (!IsValidDNSDomain(key.first))
+ continue;
key.first = base::ToLowerASCII(key.first);
IPAddress* mapped_ip = &(*dns_hosts)[key];
if (mapped_ip->empty())
« no previous file with comments | « no previous file | net/dns/dns_hosts_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698