Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Unified Diff: base/path_service.cc

Issue 12090003: Remove ".." from PathService take #2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/base_paths_mac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/path_service.cc
diff --git a/base/path_service.cc b/base/path_service.cc
index 2697653b39ef1699ad330814fdd54e9e3227b2f7..aa53b0d0eba81efd25747b3f26f1b83d8695a54f 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);
« no previous file with comments | « base/base_paths_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698