From 3cd2c1c88d2646a3338cfa7888f06fe321061053 Mon Sep 17 00:00:00 2001 From: "cevans@chromium.org" Date: Wed, 6 Feb 2013 20:38:07 +0000 Subject: Add path traversal protection to Move and CopyFile too. These functions are used a lot in IPC receivers to manage storage. See http://src.chromium.org/viewvc/chrome?view=rev&revision=175642 Review URL: https://codereview.chromium.org/12223014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181045 0039d316-1c4b-4281-b951-d872f2087c98 --- base/file_util_posix.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'base/file_util_posix.cc') diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc index 49cf873..ebe3fbf 100644 --- a/base/file_util_posix.cc +++ b/base/file_util_posix.cc @@ -249,7 +249,7 @@ bool Delete(const FilePath& path, bool recursive) { return success; } -bool Move(const FilePath& from_path, const FilePath& to_path) { +bool MoveUnsafe(const FilePath& from_path, const FilePath& to_path) { base::ThreadRestrictions::AssertIOAllowed(); // Windows compatibility: if to_path exists, from_path and to_path // must be the same type, either both files, or both directories. @@ -1012,7 +1012,7 @@ FilePath GetHomeDir() { return FilePath("/tmp"); } -bool CopyFile(const FilePath& from_path, const FilePath& to_path) { +bool CopyFileUnsafe(const FilePath& from_path, const FilePath& to_path) { base::ThreadRestrictions::AssertIOAllowed(); int infile = HANDLE_EINTR(open(from_path.value().c_str(), O_RDONLY)); if (infile < 0) -- cgit v1.1