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

Unified Diff: net/dns/mock_host_resolver.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 | « net/dns/host_resolver_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/mock_host_resolver.cc
diff --git a/net/dns/mock_host_resolver.cc b/net/dns/mock_host_resolver.cc
index 4f6dc1c6cd270d41e98d8bd8e04e89093f79f3f1..08fe463cb534c70ab804ee01da580145c2c73ce3 100644
--- a/net/dns/mock_host_resolver.cc
+++ b/net/dns/mock_host_resolver.cc
@@ -113,12 +113,16 @@ int MockHostResolverBase::Resolve(const RequestInfo& info,
num_resolve_++;
size_t id = next_request_id_++;
int rv = ResolveFromIPLiteralOrCache(info, addresses);
- if (rv != ERR_DNS_CACHE_MISS) {
+ if (rv != ERR_DNS_CACHE_MISS)
return rv;
- }
- if (synchronous_mode_) {
+
+ // Just like the real resolver, refuse to do anything with invalid hostnames.
+ if (!IsValidDNSDomain(info.hostname()))
+ return ERR_NAME_NOT_RESOLVED;
+
+ if (synchronous_mode_)
return ResolveProc(info, addresses);
- }
+
// Store the request for asynchronous resolution
std::unique_ptr<RequestImpl> req(
new RequestImpl(info, addresses, callback, this, id));
« no previous file with comments | « net/dns/host_resolver_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698