1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-01-19 08:52:34 +01:00

dvander foxes

This commit is contained in:
Michael Flaherty 2018-07-31 13:17:48 -07:00
parent b9b150e638
commit 37738022ee

View File

@ -255,7 +255,7 @@ namespace SourceHook
*/ */
namespace namespace
{ {
inline bool ModuleInMemory(char *addr, size_t len) static inline bool ModuleInMemory(char *addr, size_t len)
{ {
#if SH_SYS == SH_SYS_LINUX #if SH_SYS == SH_SYS_LINUX
// On linux, first check /proc/self/maps // On linux, first check /proc/self/maps
@ -328,6 +328,10 @@ namespace SourceHook
prevHandler = signal(SIGSEGV, BadReadHandler); prevHandler = signal(SIGSEGV, BadReadHandler);
volatile const char *p = reinterpret_cast<const char*>(addr);
for (size_t i = 0; i < len; i++)
p[i];
g_BadReadCalled = false; g_BadReadCalled = false;
signal(SIGSEGV, prevHandler); signal(SIGSEGV, prevHandler);
@ -349,10 +353,8 @@ namespace SourceHook
return false; return false;
volatile const char *p = reinterpret_cast<const char *>(addr); volatile const char *p = reinterpret_cast<const char *>(addr);
char dummy;
for (size_t i = 0; i < len; i++) for (size_t i = 0; i < len; i++)
dummy = p[i]; p[i];
g_BadReadCalled = false; g_BadReadCalled = false;