summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/stringutils.cpp10
-rw-r--r--src/utils/stringutils.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 642ba0df2..b855e3b04 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -612,3 +612,13 @@ std::string &removeProtocol(std::string &url)
url = url.substr(i + 3);
return url;
}
+
+bool checkPath(std::string path)
+{
+ if (path.empty())
+ return true;
+ return path.find("../") == std::string::npos
+ && path.find("..\\") == std::string::npos
+ && path.find("/..") == std::string::npos
+ && path.find("\\..") == std::string::npos;
+}
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index 0913c7348..c6eb08a6c 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -206,4 +206,6 @@ bool findCutFirst(std::string &str1, std::string str2);
std::string &removeProtocol(std::string &url);
+bool checkPath(std::string path);
+
#endif // UTILS_STRINGUTILS_H