summaryrefslogtreecommitdiffstats
path: root/base/files
diff options
context:
space:
mode:
authorrouslan@chromium.org <rouslan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-16 19:46:56 +0000
committerrouslan@chromium.org <rouslan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-16 19:46:56 +0000
commit08c627d0b9f2854baf1e2b37229b7101b2b21a53 (patch)
treea73314b3c7641da6cab8dea184242f60c27d50d5 /base/files
parent871f053a4f6ef28dbf0a8db9572d44b305edea69 (diff)
downloadchromium_src-08c627d0b9f2854baf1e2b37229b7101b2b21a53.zip
chromium_src-08c627d0b9f2854baf1e2b37229b7101b2b21a53.tar.gz
chromium_src-08c627d0b9f2854baf1e2b37229b7101b2b21a53.tar.bz2
Revert 200603 "Make Windows traversal checking handle pathologic..."
Seems to have broken base_unittests on Linux ASAN. > Make Windows traversal checking handle pathological cases > > Different versions of Windows have undocumented quirks in handling path components > (e.g. truncating or ignoring certain leading or trailing characters). In order to avoid potential > security bugs we're going to treat components more loosely and risk a few unlikely false > positives from FilePath::ReferencesParent(). > > BUG=181617 > R=brettw@chromium.org, ericu@chromium.org > > Review URL: https://codereview.chromium.org/12771015 TBR=jschuh@chromium.org Review URL: https://codereview.chromium.org/15095015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@200610 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/files')
-rw-r--r--base/files/file_path.cc9
-rw-r--r--base/files/file_path_unittest.cc6
2 files changed, 1 insertions, 14 deletions
diff --git a/base/files/file_path.cc b/base/files/file_path.cc
index 03ccbcd..e9495a1 100644
--- a/base/files/file_path.cc
+++ b/base/files/file_path.cc
@@ -553,15 +553,8 @@ bool FilePath::ReferencesParent() const {
std::vector<StringType>::const_iterator it = components.begin();
for (; it != components.end(); ++it) {
const StringType& component = *it;
- // Windows has odd, undocumented behavior with path components containing
- // only whitespace and . characters. So, if all we see is . and
- // whitespace, then we treat any .. sequence as referencing parent.
- // For simplicity we enforce this on all platforms.
- if (component.find_first_not_of(FILE_PATH_LITERAL(". \n\r\t")) ==
- std::string::npos &&
- component.find(kParentDirectory) != std::string::npos) {
+ if (component == kParentDirectory)
return true;
- }
}
return false;
}
diff --git a/base/files/file_path_unittest.cc b/base/files/file_path_unittest.cc
index 4dc1e7f..dbc9244 100644
--- a/base/files/file_path_unittest.cc
+++ b/base/files/file_path_unittest.cc
@@ -401,9 +401,6 @@ TEST_F(FilePathTest, IsAbsolute) {
{ FPL("//a"), true },
{ FPL("c:a/b"), false },
{ FPL("?:/a"), false },
- { FPL("/.. "), false },
- { FPL("/ .."), false },
- { FPL("/..."), false },
#if defined(FILE_PATH_USES_DRIVE_LETTERS)
{ FPL("/"), false },
{ FPL("/a"), false },
@@ -431,9 +428,6 @@ TEST_F(FilePathTest, IsAbsolute) {
{ FPL("//a"), true },
{ FPL("c:a\\b"), false },
{ FPL("?:\\a"), false },
- { FPL("\\.. "), false },
- { FPL("\\ .."), false },
- { FPL("\\..."), false },
#if defined(FILE_PATH_USES_DRIVE_LETTERS)
{ FPL("\\"), false },
{ FPL("\\a"), false },