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; }