| Index: components/update_client/utils.cc
|
| diff --git a/components/update_client/utils.cc b/components/update_client/utils.cc
|
| index a6ec277e6e9708eee70cc64c8b8afed32620be43..a76e07329fac74a7c32c71d97fdb4edfd8fe4e9a 100644
|
| --- a/components/update_client/utils.cc
|
| +++ b/components/update_client/utils.cc
|
| @@ -6,6 +6,8 @@
|
|
|
| #include <stddef.h>
|
| #include <stdint.h>
|
| +
|
| +#include <algorithm>
|
| #include <cmath>
|
| #include <cstring>
|
| #include <vector>
|
| @@ -226,4 +228,14 @@ bool VerifyFileHash256(const base::FilePath& filepath,
|
| return memcmp(actual_hash, &expected_hash[0], sizeof(actual_hash)) == 0;
|
| }
|
|
|
| +bool IsValidBrand(const std::string& brand) {
|
| + const size_t kMaxBrandSize = 4;
|
| + if (brand.size() > kMaxBrandSize)
|
| + return false;
|
| +
|
| + return std::find_if_not(brand.begin(), brand.end(), [](char ch) {
|
| + return base::IsAsciiAlpha(ch);
|
| + }) == brand.end();
|
| +}
|
| +
|
| } // namespace update_client
|
|
|