From 6ebd6c0f16cf15bb455b81ca571ef88bac381655 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 28 Feb 2017 00:54:28 +0300 Subject: Add path sanitization in virtfsdir. --- src/fs/paths.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/fs/paths.cpp') diff --git a/src/fs/paths.cpp b/src/fs/paths.cpp index aa1c453b0..8a9969461 100644 --- a/src/fs/paths.cpp +++ b/src/fs/paths.cpp @@ -27,6 +27,7 @@ #include "fs/paths.h" #include "fs/virtfs.h" +#include "utils/checkutils.h" #include "utils/stringutils.h" #ifdef USE_X11 @@ -101,6 +102,19 @@ bool checkPath(const std::string &path) && path.find("\\..") == std::string::npos; } +void prepareFsPath(std::string &path) +{ + std::string path2 = path; + sanitizePath(path); +// can be enabled for debugging +// if (path != path2) +// { +// reportAlways("Path can be improved: '%s' -> '%s'", +// path2.c_str(), +// path0.c_str()); +// } +} + std::string &fixDirSeparators(std::string &str) { if (dirSeparator[0] == '/') -- cgit v1.2.3-70-g09d2