diff --git a/src/common/file_system.cpp b/src/common/file_system.cpp index 6e8464004..4cf26011a 100644 --- a/src/common/file_system.cpp +++ b/src/common/file_system.cpp @@ -451,7 +451,7 @@ void CanonicalizePath(char* Destination, u32 cbDestination, const char* Path, bo { char prevCh = (i > 0) ? Path[i - 1] : '\0'; char currentCh = Path[i]; - char nextCh = (i < pathLength) ? Path[i + 1] : '\0'; + char nextCh = (i < (pathLength - 1)) ? Path[i + 1] : '\0'; if (currentCh == '.') { @@ -557,8 +557,8 @@ void CanonicalizePath(std::string& path, bool OSPath /*= true*/) static inline bool FileSystemCharacterIsSane(char c, bool StripSlashes) { - if (!(c >= 'a' && c <= 'z') && !(c >= 'A' && c <= 'Z') && !(c >= '0' && c <= '9') && c != ' ' && c != ' ' && - c != '_' && c != '-' && c != '.') + if (!(c >= 'a' && c <= 'z') && !(c >= 'A' && c <= 'Z') && !(c >= '0' && c <= '9') && c != ' ' && c != '_' && + c != '-' && c != '.') { if (!StripSlashes && (c == '/' || c == '\\')) return true;