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

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

Issue 16595: Ignore GetHash results for lists that we don't support. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_util.h ('k') | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/hmac.h" 7 #include "base/hmac.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/sha2.h" 9 #include "base/sha2.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 10 matching lines...) Expand all
21 static const char kContinueUrlFormat[] = 21 static const char kContinueUrlFormat[] =
22 "http://www.google.com/tools/firefox/toolbar/FT2/intl/%s/submit_success.html"; 22 "http://www.google.com/tools/firefox/toolbar/FT2/intl/%s/submit_success.html";
23 23
24 static const char kReportParams[] = "?tpl=generic&continue=%s&url=%s"; 24 static const char kReportParams[] = "?tpl=generic&continue=%s&url=%s";
25 25
26 namespace safe_browsing_util { 26 namespace safe_browsing_util {
27 27
28 const char kMalwareList[] = "goog-malware-shavar"; 28 const char kMalwareList[] = "goog-malware-shavar";
29 const char kPhishingList[] = "goog-phish-shavar"; 29 const char kPhishingList[] = "goog-phish-shavar";
30 30
31 int GetListId(const std::string& name) {
32 if (name == kMalwareList)
33 return MALWARE;
34 else if (name == kPhishingList)
35 return PHISH;
36
37 return -1;
38 }
39
40 std::string GetListName(int list_id) {
41 switch (list_id) {
42 case MALWARE:
43 return kMalwareList;
44 case PHISH:
45 return kPhishingList;
46 default:
47 return "";
48 }
49 }
50
31 void GenerateHostsToCheck(const GURL& url, std::vector<std::string>* hosts) { 51 void GenerateHostsToCheck(const GURL& url, std::vector<std::string>* hosts) {
32 // Per Safe Browsing Protocol 2 spec, first we try the host. Then we try up 52 // Per Safe Browsing Protocol 2 spec, first we try the host. Then we try up
33 // to 4 hostnames starting with the last 5 components and successively 53 // to 4 hostnames starting with the last 5 components and successively
34 // removing the leading component. The TLD is skipped. 54 // removing the leading component. The TLD is skipped.
35 hosts->clear(); 55 hosts->clear();
36 int hostnames_checked = 0; 56 int hostnames_checked = 0;
37 57
38 std::string host = url.host(); 58 std::string host = url.host();
39 if (host.empty()) 59 if (host.empty())
40 return; 60 return;
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 632
613 // Validate that the next entry is wholly contained inside of |data_|. 633 // Validate that the next entry is wholly contained inside of |data_|.
614 const char* end = data_.get() + size_; 634 const char* end = data_.get() + size_;
615 if (next + SBEntry::kMinSize <= end && next + next_entry->Size() <= end) { 635 if (next + SBEntry::kMinSize <= end && next + next_entry->Size() <= end) {
616 *entry = next_entry; 636 *entry = next_entry;
617 return true; 637 return true;
618 } 638 }
619 639
620 return false; 640 return false;
621 } 641 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698