Commit 3f53d813 authored by Eric Roman's avatar Eric Roman Committed by Commit Bot

Make use of new hex decoding functions for safe browsing code.

Bug: 1021236
Change-Id: I19ec9a8d9618ec8b28deb95cbe46d9ea25be66e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1896394
Commit-Queue: Daniel Rubery <drubery@chromium.org>
Auto-Submit: Eric Roman <eroman@chromium.org>
Reviewed-by: default avatarDaniel Rubery <drubery@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712382}
parent 61670e0b
......@@ -153,9 +153,9 @@ void DownloadProtectionService::ParseManualBlacklistFlag() {
safe_browsing::switches::kSbManualDownloadBlacklist);
for (const std::string& hash_hex : base::SplitString(
flag_val, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY)) {
std::vector<uint8_t> bytes;
if (base::HexStringToBytes(hash_hex, &bytes) && bytes.size() == 32) {
manual_blacklist_hashes_.insert(std::string(bytes.begin(), bytes.end()));
std::string bytes;
if (base::HexStringToString(hash_hex, &bytes) && bytes.size() == 32) {
manual_blacklist_hashes_.insert(std::move(bytes));
} else {
LOG(FATAL) << "Bad sha256 hex value '" << hash_hex << "' found in --"
<< safe_browsing::switches::kSbManualDownloadBlacklist;
......
......@@ -2683,10 +2683,9 @@ class DownloadProtectionServiceFlagTest : public DownloadProtectionServiceTest {
"b") {}
void SetUp() override {
std::vector<uint8_t> bytes;
ASSERT_TRUE(base::HexStringToBytes(blacklisted_hash_hex_, &bytes) &&
bytes.size() == 32);
blacklisted_hash_ = std::string(bytes.begin(), bytes.end());
ASSERT_TRUE(
base::HexStringToString(blacklisted_hash_hex_, &blacklisted_hash_) &&
blacklisted_hash_.size() == 32);
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
safe_browsing::switches::kSbManualDownloadBlacklist,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment