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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_util.cc

Issue 1180393003: Added characters that look like padlocks to URL unescaping blacklist. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename NON_DISPLAY_CHARS to SPOOFING_AND_CONTROL_CHARS. Created 5 years, 6 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 | « no previous file | chrome/common/instant_types.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 "chrome/browser/safe_browsing/safe_browsing_util.h" 5 #include "chrome/browser/safe_browsing/safe_browsing_util.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 return true; 265 return true;
266 } 266 }
267 267
268 std::string Unescape(const std::string& url) { 268 std::string Unescape(const std::string& url) {
269 std::string unescaped_str(url); 269 std::string unescaped_str(url);
270 std::string old_unescaped_str; 270 std::string old_unescaped_str;
271 const int kMaxLoopIterations = 1024; 271 const int kMaxLoopIterations = 1024;
272 int loop_var = 0; 272 int loop_var = 0;
273 do { 273 do {
274 old_unescaped_str = unescaped_str; 274 old_unescaped_str = unescaped_str;
275 unescaped_str = net::UnescapeURLComponent(old_unescaped_str, 275 unescaped_str = net::UnescapeURLComponent(
276 net::UnescapeRule::CONTROL_CHARS | net::UnescapeRule::SPACES | 276 old_unescaped_str, net::UnescapeRule::SPOOFING_AND_CONTROL_CHARS |
277 net::UnescapeRule::URL_SPECIAL_CHARS); 277 net::UnescapeRule::SPACES |
278 net::UnescapeRule::URL_SPECIAL_CHARS);
278 } while (unescaped_str != old_unescaped_str && ++loop_var <= 279 } while (unescaped_str != old_unescaped_str && ++loop_var <=
279 kMaxLoopIterations); 280 kMaxLoopIterations);
280 281
281 return unescaped_str; 282 return unescaped_str;
282 } 283 }
283 284
284 std::string Escape(const std::string& url) { 285 std::string Escape(const std::string& url) {
285 std::string escaped_str; 286 std::string escaped_str;
286 const char* kHexString = "0123456789ABCDEF"; 287 const char* kHexString = "0123456789ABCDEF";
287 for (size_t i = 0; i < url.length(); i++) { 288 for (size_t i = 0; i < url.length(); i++) {
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 memcpy(hash_out.full_hash, hash_in.data(), crypto::kSHA256Length); 519 memcpy(hash_out.full_hash, hash_in.data(), crypto::kSHA256Length);
519 return hash_out; 520 return hash_out;
520 } 521 }
521 522
522 std::string SBFullHashToString(const SBFullHash& hash) { 523 std::string SBFullHashToString(const SBFullHash& hash) {
523 DCHECK_EQ(crypto::kSHA256Length, sizeof(hash.full_hash)); 524 DCHECK_EQ(crypto::kSHA256Length, sizeof(hash.full_hash));
524 return std::string(hash.full_hash, sizeof(hash.full_hash)); 525 return std::string(hash.full_hash, sizeof(hash.full_hash));
525 } 526 }
526 527
527 } // namespace safe_browsing_util 528 } // namespace safe_browsing_util
OLDNEW
« no previous file with comments | « no previous file | chrome/common/instant_types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698