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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_database.cc

Issue 2495783003: Implement support for checking bad IPs aka MatchMalwareIP (Closed)
Patch Set: shess@ review and trying to fix Windows build error Created 4 years, 1 month 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
Index: chrome/browser/safe_browsing/safe_browsing_database.cc
diff --git a/chrome/browser/safe_browsing/safe_browsing_database.cc b/chrome/browser/safe_browsing/safe_browsing_database.cc
index 586ee45841db2d6e9d1b19a5c9b00709ede92b11..bd87b89bb132dda31cd83b88002dce981e70fd47 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database.cc
@@ -27,6 +27,7 @@
#include "build/build_config.h"
#include "chrome/browser/safe_browsing/safe_browsing_store_file.h"
#include "components/safe_browsing_db/prefix_set.h"
+#include "components/safe_browsing_db/v4_protocol_manager_util.h"
#include "content/public/browser/browser_thread.h"
#include "crypto/sha2.h"
#include "net/base/ip_address.h"
@@ -958,12 +959,9 @@ bool SafeBrowsingDatabaseNew::ContainsExtensionPrefixes(
bool SafeBrowsingDatabaseNew::ContainsMalwareIP(const std::string& ip_address) {
net::IPAddress address;
- if (!address.AssignFromIPLiteral(ip_address))
+ if (!V4ProtocolManagerUtil::GetIPV6AddressFromString(ip_address, &address)) {
return false;
- if (address.IsIPv4())
- address = net::ConvertIPv4ToIPv4MappedIPv6(address);
- if (!address.IsIPv6())
- return false; // better safe than sorry.
+ }
std::unique_ptr<ReadTransaction> txn = state_manager_.BeginReadTransaction();
const IPBlacklist* ip_blacklist = txn->ip_blacklist();

Powered by Google App Engine
This is Rietveld 408576698