From 6054cb673d150d3cf22c63c4f31c584d069dc2fe Mon Sep 17 00:00:00 2001 From: Tomas Jakobsson Date: Fri, 2 Feb 2018 16:45:21 +0100 Subject: [PATCH] Fix start and offset not being reset for each invalidChar tested in Utils::FileSystem::GetEscapedPath --- es-core/src/utils/FileSystemUtil.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/es-core/src/utils/FileSystemUtil.cpp b/es-core/src/utils/FileSystemUtil.cpp index 5618695c6..ea678b913 100644 --- a/es-core/src/utils/FileSystemUtil.cpp +++ b/es-core/src/utils/FileSystemUtil.cpp @@ -206,11 +206,12 @@ namespace Utils // insert a backslash before most characters that would mess up a bash path const char* invalidChars = "\\ '\"!$^&*(){}[]?;<>"; const char* invalidChar = invalidChars; - size_t start = 0; - size_t offset = 0; while(*invalidChar) { + size_t start = 0; + size_t offset = 0; + while((offset = path.find(*invalidChar, start)) != std::string::npos) { start = offset + 1;