summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-09 16:41:53 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-09 16:41:53 +0000
commit87d4321bbed8d21bf8284e2a970ac4a862681bc0 (patch)
treee263fd6563948a23a71a563b628a48adeb766c6c /net
parentc8a729332e21c894aaebd5c2dd22d9a0e39377ff (diff)
downloadchromium_src-87d4321bbed8d21bf8284e2a970ac4a862681bc0.zip
chromium_src-87d4321bbed8d21bf8284e2a970ac4a862681bc0.tar.gz
chromium_src-87d4321bbed8d21bf8284e2a970ac4a862681bc0.tar.bz2
net: fix matching ".google.com" at the end of a string.
BUG=none TEST=none http://codereview.chromium.org/6975002/ git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84630 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/socket/ssl_client_socket_pool.cc3
-rw-r--r--net/socket/ssl_host_info.cc3
2 files changed, 4 insertions, 2 deletions
diff --git a/net/socket/ssl_client_socket_pool.cc b/net/socket/ssl_client_socket_pool.cc
index 5f8daa7..75d36cb 100644
--- a/net/socket/ssl_client_socket_pool.cc
+++ b/net/socket/ssl_client_socket_pool.cc
@@ -338,7 +338,8 @@ int SSLConnectJob::DoSSLConnectComplete(int result) {
const std::string& host = params_->host_and_port().host();
bool is_google = host == "google.com" ||
- host.rfind(".google.com") == host.size() - 11;
+ (host.size() > 11 &&
+ host.rfind(".google.com") == host.size() - 11);
if (is_google) {
UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_Google",
connect_duration,
diff --git a/net/socket/ssl_host_info.cc b/net/socket/ssl_host_info.cc
index 75a6f378..347dada 100644
--- a/net/socket/ssl_host_info.cc
+++ b/net/socket/ssl_host_info.cc
@@ -188,7 +188,8 @@ void SSLHostInfo::VerifyCallback(int rv) {
base::TimeTicks now = base::TimeTicks::Now();
const base::TimeDelta duration = now - verification_start_time();
bool is_google = hostname_ == "google.com" ||
- hostname_.rfind(".google.com") == hostname_.size() - 11;
+ (hostname_.size() > 11 &&
+ hostname_.rfind(".google.com") == hostname_.size() - 11);
if (is_google) {
UMA_HISTOGRAM_TIMES("Net.SSLHostInfoVerificationTimeMs_Google", duration);
}