summaryrefslogtreecommitdiffstats
path: root/base/path_service.cc
diff options
context:
space:
mode:
authormaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-26 04:51:29 +0000
committermaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-26 04:51:29 +0000
commit082f820ae49809c136de8a1161618ebbe755f9e0 (patch)
tree9ddbe59621b43cc03baa36a4c250d354427f91e7 /base/path_service.cc
parent303e7bab6e006fcea8fb09b29b726fc80394d8ab (diff)
downloadchromium_src-082f820ae49809c136de8a1161618ebbe755f9e0.zip
chromium_src-082f820ae49809c136de8a1161618ebbe755f9e0.tar.gz
chromium_src-082f820ae49809c136de8a1161618ebbe755f9e0.tar.bz2
Remove ".." from PathService take #2.
Hook directly into PathService::Get() and only convert to an absolute path when ".." is found in the path. Otherwise leave it as-is. In particular, this won't trigger when the path is simply relative, like "./unit_tests". This is necessary to make most test cases pass but this has the advatange of not triggering in the common case for Google Chrome. R=cpu@chromium.org,mark@chromium.org BUG=168890 Review URL: https://chromiumcodereview.appspot.com/12090003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179042 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/path_service.cc')
-rw-r--r--base/path_service.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/base/path_service.cc b/base/path_service.cc
index 2697653..aa53b0d 100644
--- a/base/path_service.cc
+++ b/base/path_service.cc
@@ -209,6 +209,12 @@ bool PathService::Get(int key, FilePath* result) {
if (path.empty())
return false;
+ if (path.ReferencesParent()) {
+ // Make sure path service never returns a path with ".." in it.
+ if (!file_util::AbsolutePath(&path)) {
+ return false;
+ }
+ }
*result = path;
base::AutoLock scoped_lock(path_data->lock);