| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/extensions/external_pref_extension_provider.h" | 5 #include "chrome/browser/extensions/external_pref_extension_provider.h" |
| 6 | 6 |
| 7 #include "app/app_paths.h" | 7 #include "app/app_paths.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 FilePath::StringType external_crx; | 52 FilePath::StringType external_crx; |
| 53 std::string external_version; | 53 std::string external_version; |
| 54 if (!extension->GetString(kExternalCrx, &external_crx) || | 54 if (!extension->GetString(kExternalCrx, &external_crx) || |
| 55 !extension->GetString(kExternalVersion, &external_version)) { | 55 !extension->GetString(kExternalVersion, &external_version)) { |
| 56 LOG(WARNING) << "Malformed extension dictionary for extension: " | 56 LOG(WARNING) << "Malformed extension dictionary for extension: " |
| 57 << extension_id.c_str(); | 57 << extension_id.c_str(); |
| 58 continue; | 58 continue; |
| 59 } | 59 } |
| 60 | 60 |
| 61 if (external_crx.find(FilePath::kParentDirectory) != StringPiece::npos) { | 61 if (external_crx.find(FilePath::kParentDirectory) != |
| 62 base::StringPiece::npos) { |
| 62 LOG(WARNING) << "Path traversal not allowed in path: " | 63 LOG(WARNING) << "Path traversal not allowed in path: " |
| 63 << external_crx.c_str(); | 64 << external_crx.c_str(); |
| 64 continue; | 65 continue; |
| 65 } | 66 } |
| 66 | 67 |
| 67 // See if it's an absolute path... | 68 // See if it's an absolute path... |
| 68 FilePath path(external_crx); | 69 FilePath path(external_crx); |
| 69 if (!path.IsAbsolute()) { | 70 if (!path.IsAbsolute()) { |
| 70 // Try path as relative path from external extension dir. | 71 // Try path as relative path from external extension dir. |
| 71 FilePath base_path; | 72 FilePath base_path; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 if (extensions) { | 109 if (extensions) { |
| 109 if (!extensions->IsType(Value::TYPE_DICTIONARY)) { | 110 if (!extensions->IsType(Value::TYPE_DICTIONARY)) { |
| 110 NOTREACHED() << L"Invalid json data"; | 111 NOTREACHED() << L"Invalid json data"; |
| 111 } else { | 112 } else { |
| 112 dictionary.reset(static_cast<DictionaryValue*>(extensions)); | 113 dictionary.reset(static_cast<DictionaryValue*>(extensions)); |
| 113 } | 114 } |
| 114 } | 115 } |
| 115 } | 116 } |
| 116 prefs_.reset(dictionary.release()); | 117 prefs_.reset(dictionary.release()); |
| 117 } | 118 } |
| OLD | NEW |