diff --git a/SilentPatch/Patterns.cpp b/SilentPatch/Patterns.cpp index f4aebce..431667c 100644 --- a/SilentPatch/Patterns.cpp +++ b/SilentPatch/Patterns.cpp @@ -223,7 +223,7 @@ void pattern::EnsureMatches(uint32_t maxCount) } i++; } - else i += std::max(1, j - Last[ ptr[j] ]); + else i += std::max(ptrdiff_t(1), j - Last[ ptr[j] ]); } m_matched = true; diff --git a/SilentPatch/Patterns.h b/SilentPatch/Patterns.h index 4085b3e..e146b9b 100644 --- a/SilentPatch/Patterns.h +++ b/SilentPatch/Patterns.h @@ -117,7 +117,7 @@ namespace hook pattern(const char (&pattern)[Len]) : pattern(getRVA(0)) { - Initialize(pattern, Len); + Initialize(pattern, Len-1); } inline pattern& count(uint32_t expected) & @@ -203,7 +203,7 @@ namespace hook module_pattern(void* module, const char(&pattern)[Len]) : pattern(module) { - Initialize(pattern, Len); + Initialize(pattern, Len-1); } }; @@ -215,7 +215,7 @@ namespace hook range_pattern(uintptr_t begin, uintptr_t end, const char(&pattern)[Len]) : pattern(begin, end) { - Initialize(pattern, Len); + Initialize(pattern, Len-1); } };