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

Unified Diff: content/browser/child_process_security_policy_impl.cc

Issue 11416218: Merge 168692 - Apply missing kParentDirectory check (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1312/src/
Patch Set: Created 8 years, 1 month 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 | « no previous file | content/browser/child_process_security_policy_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/child_process_security_policy_impl.cc
===================================================================
--- content/browser/child_process_security_policy_impl.cc (revision 169793)
+++ content/browser/child_process_security_policy_impl.cc (working copy)
@@ -145,9 +145,18 @@
bool HasPermissionsForFile(const FilePath& file, int permissions) {
FilePath current_path = file.StripTrailingSeparators();
FilePath last_path;
+ int skip = 0;
while (current_path != last_path) {
- if (file_permissions_.find(current_path) != file_permissions_.end())
- return (file_permissions_[current_path] & permissions) == permissions;
+ FilePath base_name = current_path.BaseName();
+ if (base_name.value() == FilePath::kParentDirectory) {
+ ++skip;
+ } else if (skip > 0) {
+ if (base_name.value() != FilePath::kCurrentDirectory)
+ --skip;
+ } else {
+ if (file_permissions_.find(current_path) != file_permissions_.end())
+ return (file_permissions_[current_path] & permissions) == permissions;
+ }
last_path = current_path;
current_path = current_path.DirName();
}
« no previous file with comments | « no previous file | content/browser/child_process_security_policy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698