fix: Sigscanner (#471)

This commit is contained in:
Forever Gone 2022-10-16 03:11:33 -04:00 committed by GitHub
parent dc60780e27
commit baa38f6fcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,7 +62,8 @@ namespace memory
} }
//Loop data //Loop data
for (std::size_t current_idx{}; current_idx != module_size - length;) const auto scan_end = module_size - length;
for (std::size_t current_idx{}; current_idx != scan_end;)
{ {
for (std::size_t sig_idx{ max_idx }; sig_idx >= 0; --sig_idx) for (std::size_t sig_idx{ max_idx }; sig_idx >= 0; --sig_idx)
{ {
@ -73,7 +74,7 @@ namespace memory
} }
else if (sig_idx == NULL) else if (sig_idx == NULL)
{ {
return begin.add(sig_idx); return begin.add(current_idx);
} }
} }
} }
@ -111,8 +112,8 @@ namespace memory
auto data = sig.m_bytes.data(); auto data = sig.m_bytes.data();
auto length = sig.m_bytes.size(); auto length = sig.m_bytes.size();
const auto search_end = m_size - length; const auto scan_end = m_size - length;
for (std::uintptr_t i{}; i != search_end; ++i) for (std::uintptr_t i{}; i != scan_end; ++i)
{ {
if (pattern_matches(m_base.add(i).as<std::uint8_t*>(), data, length)) if (pattern_matches(m_base.add(i).as<std::uint8_t*>(), data, length))
{ {