summaryrefslogtreecommitdiffstats
path: root/base/platform_file.cc
diff options
context:
space:
mode:
authorcpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-09 00:38:59 +0000
committercpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-09 00:38:59 +0000
commit9fea5a9b229b6a114629c8787f614b2e9f1048fc (patch)
treea7c6e2a2fcf047e7951cf33e96047f0d511e8655 /base/platform_file.cc
parentc79ca045d5c7e03eb5d9bd7e6bd42fff6cf169fb (diff)
downloadchromium_src-9fea5a9b229b6a114629c8787f614b2e9f1048fc.zip
chromium_src-9fea5a9b229b6a114629c8787f614b2e9f1048fc.tar.gz
chromium_src-9fea5a9b229b6a114629c8787f614b2e9f1048fc.tar.bz2
Don't allow path traversal paths on the base file helpers
This forces explicit normalization of paths and make path escaping security bugs much harder to exploit. See for example bug 167122 BUG=168890 TEST=included tests Review URL: https://codereview.chromium.org/11782005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175642 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/platform_file.cc')
-rw-r--r--base/platform_file.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/base/platform_file.cc b/base/platform_file.cc
index 70700fc..31eef01 100644
--- a/base/platform_file.cc
+++ b/base/platform_file.cc
@@ -14,4 +14,15 @@ PlatformFileInfo::PlatformFileInfo()
PlatformFileInfo::~PlatformFileInfo() {}
+PlatformFile CreatePlatformFile(const FilePath& name,
+ int flags,
+ bool* created,
+ PlatformFileError* error) {
+ if (name.ReferencesParent()) {
+ *error = PLATFORM_FILE_ERROR_ACCESS_DENIED;
+ return kInvalidPlatformFileValue;
+ }
+ return CreatePlatformFileUnsafe(name, flags, created, error);
+}
+
} // namespace base