| Index: chrome/browser/extensions/extension.cc
|
| ===================================================================
|
| --- chrome/browser/extensions/extension.cc (revision 10469)
|
| +++ chrome/browser/extensions/extension.cc (working copy)
|
| @@ -69,6 +69,8 @@
|
| const char* Extension::kInvalidPluginsDirError =
|
| "Invalid value for 'plugins_dir'.";
|
|
|
| +const int Extension::kIdSize = 20; // SHA1 (160 bits) == 20 bytes
|
| +
|
| const std::string Extension::VersionString() const {
|
| return version_->GetString();
|
| }
|
| @@ -172,22 +174,14 @@
|
| *error = kInvalidIdError;
|
| return false;
|
| }
|
| - // Verify that the id is legal. This test is basically verifying that it
|
| - // is ASCII and doesn't have any path components in it.
|
| - // TODO(erikkay): verify the actual id format - it will be more restrictive
|
| - // than this. Perhaps just a hex string?
|
| - if (!IsStringASCII(id_)) {
|
| +
|
| + // Verify that the id is legal. The id is a hex string of the SHA-1 hash of
|
| + // the public key.
|
| + std::vector<uint8> id_bytes;
|
| + if (!HexStringToBytes(id_, &id_bytes) || id_bytes.size() != kIdSize) {
|
| *error = kInvalidIdError;
|
| return false;
|
| }
|
| - FilePath id_path;
|
| - id_path = id_path.AppendASCII(id_);
|
| - if ((id_path.value() == FilePath::kCurrentDirectory) ||
|
| - (id_path.value() == FilePath::kParentDirectory) ||
|
| - !(id_path.BaseName() == id_path)) {
|
| - *error = kInvalidIdError;
|
| - return false;
|
| - }
|
|
|
| // Initialize URL.
|
| extension_url_ = GURL(std::string(chrome::kExtensionScheme) +
|
|
|