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

Unified Diff: chrome/common/extensions/extension_resource.cc

Issue 295001: Routines in our upper file layers can't handle ".." or "symlinks" well (and a... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension_resource.cc
===================================================================
--- chrome/common/extensions/extension_resource.cc (revision 29378)
+++ chrome/common/extensions/extension_resource.cc (working copy)
@@ -69,9 +69,15 @@
if (!net::FileURLToFilePath(file_url, &ret_val))
return FilePath();
+ // Converting the extension_url back to a path removes all .. and . references
+ // that may have been in extension_path that would cause isParent to break.
+ FilePath sanitized_extension_path;
+ if (!net::FileURLToFilePath(extension_url, &sanitized_extension_path))
+ return FilePath();
+
// Double-check that the path we ended up with is actually inside the
// extension root.
- if (!extension_path.IsParent(ret_val))
+ if (!sanitized_extension_path.IsParent(ret_val))
return FilePath();
return ret_val;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698