summaryrefslogtreecommitdiff
path: root/src/fs/paths.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-02-28 00:54:28 +0300
committerAndrei Karas <akaras@inbox.ru>2017-02-28 00:54:28 +0300
commit6ebd6c0f16cf15bb455b81ca571ef88bac381655 (patch)
tree2be6a21600c7e0f8c0067c494e2510d6f3c0129c /src/fs/paths.cpp
parenteb5128aa6ce4a33aa9021b51231d0934294c7caa (diff)
downloadmanaplus-6ebd6c0f16cf15bb455b81ca571ef88bac381655.tar.gz
manaplus-6ebd6c0f16cf15bb455b81ca571ef88bac381655.tar.bz2
manaplus-6ebd6c0f16cf15bb455b81ca571ef88bac381655.tar.xz
manaplus-6ebd6c0f16cf15bb455b81ca571ef88bac381655.zip
Add path sanitization in virtfsdir.
Diffstat (limited to 'src/fs/paths.cpp')
-rw-r--r--src/fs/paths.cpp14
1 files changed, 14 insertions, 0 deletions
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] == '/')