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

Side by Side Diff: net/dns/host_resolver_impl.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 unified diff | Download patch
« no previous file with comments | « net/dns/dns_util.cc ('k') | net/dns/mock_host_resolver.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/dns/host_resolver_impl.h" 5 #include "net/dns/host_resolver_impl.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <Winsock2.h> 8 #include <Winsock2.h>
9 #elif defined(OS_POSIX) 9 #elif defined(OS_POSIX)
10 #include <netdb.h> 10 #include <netdb.h>
(...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after
1912 AddressList* addresses, 1912 AddressList* addresses,
1913 const CompletionCallback& callback, 1913 const CompletionCallback& callback,
1914 std::unique_ptr<Request>* out_req, 1914 std::unique_ptr<Request>* out_req,
1915 const BoundNetLog& source_net_log) { 1915 const BoundNetLog& source_net_log) {
1916 DCHECK(addresses); 1916 DCHECK(addresses);
1917 DCHECK(CalledOnValidThread()); 1917 DCHECK(CalledOnValidThread());
1918 DCHECK_EQ(false, callback.is_null()); 1918 DCHECK_EQ(false, callback.is_null());
1919 DCHECK(out_req); 1919 DCHECK(out_req);
1920 1920
1921 // Check that the caller supplied a valid hostname to resolve. 1921 // Check that the caller supplied a valid hostname to resolve.
1922 std::string labeled_hostname; 1922 if (!IsValidDNSDomain(info.hostname()))
1923 if (!DNSDomainFromDot(info.hostname(), &labeled_hostname))
1924 return ERR_NAME_NOT_RESOLVED; 1923 return ERR_NAME_NOT_RESOLVED;
1925 1924
1926 LogStartRequest(source_net_log, info); 1925 LogStartRequest(source_net_log, info);
1927 1926
1928 IPAddress ip_address; 1927 IPAddress ip_address;
1929 IPAddress* ip_address_ptr = nullptr; 1928 IPAddress* ip_address_ptr = nullptr;
1930 if (ip_address.AssignFromIPLiteral(info.hostname())) 1929 if (ip_address.AssignFromIPLiteral(info.hostname()))
1931 ip_address_ptr = &ip_address; 1930 ip_address_ptr = &ip_address;
1932 1931
1933 // Build a key that identifies the request in the cache and in the 1932 // Build a key that identifies the request in the cache and in the
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
2608 if (job_) 2607 if (job_)
2609 job_->CancelRequest(this); 2608 job_->CancelRequest(this);
2610 } 2609 }
2611 2610
2612 void HostResolverImpl::RequestImpl::ChangeRequestPriority( 2611 void HostResolverImpl::RequestImpl::ChangeRequestPriority(
2613 RequestPriority priority) { 2612 RequestPriority priority) {
2614 job_->ChangeRequestPriority(this, priority); 2613 job_->ChangeRequestPriority(this, priority);
2615 } 2614 }
2616 2615
2617 } // namespace net 2616 } // namespace net
OLDNEW
« no previous file with comments | « net/dns/dns_util.cc ('k') | net/dns/mock_host_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698