From 82260a54abbe8a6368d3a5f5da5291e0c4f2eb08 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 11 Feb 2017 19:40:46 +0300 Subject: Add checks into virtfs.cpp for correct calls add/remove dirs or archives. --- src/utils/virtfs.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/utils/virtfs.cpp b/src/utils/virtfs.cpp index ef70d119e..7f4c7ab3b 100644 --- a/src/utils/virtfs.cpp +++ b/src/utils/virtfs.cpp @@ -22,6 +22,7 @@ #include "logger.h" +#include "utils/checkutils.h" #include "utils/virtfile.h" #include "utils/virtfileprivate.h" @@ -139,24 +140,44 @@ namespace VirtFs bool addDirToSearchPath(const std::string &newDir, const Append append) { + if (newDir.find(".zip") != std::string::npos) + { + reportAlways("Called addDirToSearchPath with zip archive"); + return false; + } return PHYSFS_addToSearchPath(newDir.c_str(), append == Append_true ? 1 : 0); } bool removeDirFromSearchPath(const std::string &oldDir) { + if (oldDir.find(".zip") != std::string::npos) + { + reportAlways("Called removeDirFromSearchPath with zip archive"); + return false; + } return PHYSFS_removeFromSearchPath(oldDir.c_str()); } bool addZipToSearchPath(const std::string &newDir, const Append append) { + if (newDir.find(".zip") == std::string::npos) + { + reportAlways("Called addZipToSearchPath without zip archive"); + return false; + } return PHYSFS_addToSearchPath(newDir.c_str(), append == Append_true ? 1 : 0); } bool removeZipFromSearchPath(const std::string &oldDir) { + if (oldDir.find(".zip") == std::string::npos) + { + reportAlways("Called removeZipFromSearchPath without zip archive"); + return false; + } return PHYSFS_removeFromSearchPath(oldDir.c_str()); } -- cgit v1.2.3-70-g09d2