From cda2914a27543e070c35bc669e9e4721bf66d1f3 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Tue, 7 Aug 2018 01:03:41 -0400 Subject: [PATCH] engine bugfix --- vnrhook/src/util/ithsys/ithsys.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vnrhook/src/util/ithsys/ithsys.cc b/vnrhook/src/util/ithsys/ithsys.cc index bc304f8..a1a7232 100644 --- a/vnrhook/src/util/ithsys/ithsys.cc +++ b/vnrhook/src/util/ithsys/ithsys.cc @@ -49,8 +49,11 @@ DWORD SearchPattern(DWORD base, DWORD base_length, LPCVOID search, DWORD search_ { // Artikash 7/14/2018: not sure, but I think this could throw read access violation if I dont subtract search_length for (int i = 0; i < base_length - search_length; ++i) - if (memcmp((void*)(base + i), search, search_length) == 0) - return i; + for (int j = 0; j <= search_length; ++j) + if (j == search_length) return i; // not sure about this algorithm... + else if (*((BYTE*)base + i + j) != *((BYTE*)search + j) && *((BYTE*)search + j) != 0x11) break; // 0x11 = wildcard + //if (memcmp((void*)(base + i), search, search_length) == 0) + //return i; return 0; }