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

Unified Diff: net/base/net_util.cc

Issue 23464037: Net: make IsSafePortableRelativePath look for reserved names on all components. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix comments Created 7 years, 3 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 | « net/base/net_util.h ('k') | net/base/net_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_util.cc
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index c4f00bef6ee6d51688831afe9add7eec25dc0026..ca3fe8034c7124f40c8517162c70481ad45c538b 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -1152,12 +1152,8 @@ bool IsSafePortablePathComponent(const base::FilePath& component) {
FilePathToString16(component, &component16) &&
file_util::IsFilenameLegal(component16) &&
!IsShellIntegratedExtension(extension) &&
- (sanitized == component.value());
-}
-
-bool IsSafePortableBasename(const base::FilePath& filename) {
- return IsSafePortablePathComponent(filename) &&
- !IsReservedName(filename.value());
+ (sanitized == component.value()) &&
+ !IsReservedName(component.value());
}
bool IsSafePortableRelativePath(const base::FilePath& path) {
@@ -1171,7 +1167,7 @@ bool IsSafePortableRelativePath(const base::FilePath& path) {
if (!IsSafePortablePathComponent(base::FilePath(components[i])))
return false;
}
- return IsSafePortableBasename(path.BaseName());
+ return IsSafePortablePathComponent(path.BaseName());
}
void GenerateSafeFileName(const std::string& mime_type,
« no previous file with comments | « net/base/net_util.h ('k') | net/base/net_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698