aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/ExploitFixes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'NorthstarDedicatedTest/ExploitFixes.cpp')
-rw-r--r--NorthstarDedicatedTest/ExploitFixes.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/NorthstarDedicatedTest/ExploitFixes.cpp b/NorthstarDedicatedTest/ExploitFixes.cpp
index 8a80b629..db754ad5 100644
--- a/NorthstarDedicatedTest/ExploitFixes.cpp
+++ b/NorthstarDedicatedTest/ExploitFixes.cpp
@@ -21,7 +21,10 @@ ConVar* ns_exploitfixes_log;
}())
// Make sure 3 or less floats are valid
-bool ValidateFloats(float a, float b = 0, float c = 0) { return !isnan(a) && !isnan(b) && !isnan(c); }
+bool ValidateFloats(float a, float b = 0, float c = 0)
+{
+ return !isnan(a) && !isnan(b) && !isnan(c);
+}
struct Vector
{
@@ -29,7 +32,10 @@ struct Vector
Vector(float x = 0, float y = 0, float z = 0) : x(x), y(y), z(z) {}
- bool IsValid() { return ValidateFloats(x, y, z); }
+ bool IsValid()
+ {
+ return ValidateFloats(x, y, z);
+ }
};
struct Angle
@@ -48,7 +54,10 @@ struct Angle
};
#define BLOCK_NETMSG_FUNC(name, pattern) \
- KHOOK(name, ("engine.dll", pattern), bool, __fastcall, (void* thisptr, void* buffer)) { return false; }
+ KHOOK(name, ("engine.dll", pattern), bool, __fastcall, (void* thisptr, void* buffer)) \
+ { \
+ return false; \
+ }
// Servers can literally request a screenshot from any client, yeah no
BLOCK_NETMSG_FUNC(CLC_Screenshot_WriteToBuffer, "48 89 5C 24 ? 57 48 83 EC 20 8B 42 10");
@@ -74,7 +83,7 @@ KHOOK(CClient_ProcessSetConVar, ("engine.dll", "48 8B D1 48 8B 49 18 48 8B 01 48
void* unk2;
void* m_pMessageHandler;
SetConVarEntry* m_ConVars; // convar entry array
- void* unk5; // these 2 unks are just vector capacity or whatever
+ void* unk5; // these 2 unks are just vector capacity or whatever
void* unk6;
int m_ConVars_count; // amount of cvar entries in array (this will not be out of bounds)
};
@@ -96,7 +105,7 @@ KHOOK(CClient_ProcessSetConVar, ("engine.dll", "48 8B D1 48 8B 49 18 48 8B 01 48
areWeServer = offset != CLIENTSTATE_FIRST_VFUNC_OFFSET;
}
- std::string BLOCK_PREFIX = std::string{"NET_SetConVar ("} + (areWeServer ? "server" : "client") + "): Blocked dangerous/invalid msg: ";
+ std::string BLOCK_PREFIX = std::string {"NET_SetConVar ("} + (areWeServer ? "server" : "client") + "): Blocked dangerous/invalid msg: ";
if (areWeServer)
{
@@ -132,7 +141,8 @@ KHOOK(CClient_ProcessSetConVar, ("engine.dll", "48 8B D1 48 8B 49 18 48 8B 01 48
if (realVar)
memcpy(
- entry->name, realVar->m_ConCommandBase.m_pszName,
+ entry->name,
+ realVar->m_ConCommandBase.m_pszName,
strlen(realVar->m_ConCommandBase.m_pszName) + 1); // Force name to match case
bool isValidFlags = true;
@@ -315,8 +325,11 @@ KHOOK(IsValveMod, ("engine.dll", "48 83 EC 28 48 8B 0D ? ? ? ? 48 8D 15 ? ? ? ?
// Fix respawn's crappy UTF8 parser so it doesn't crash -_-
// This also means you can launch multiplayer with "communities_enabled 1" and not crash, you're welcome
KHOOK(
- CrashFunc_ParseUTF8, ("engine.dll", "48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 41 54 41 55 41 56 41 57 48 83 EC 20 8B 1A"), bool,
- __fastcall, (INT64 * a1, DWORD* a2, char* strData))
+ CrashFunc_ParseUTF8,
+ ("engine.dll", "48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 41 54 41 55 41 56 41 57 48 83 EC 20 8B 1A"),
+ bool,
+ __fastcall,
+ (INT64 * a1, DWORD* a2, char* strData))
{
static void* targetRetAddr = NSMem::PatternScan("engine.dll", "84 C0 75 2C 49 8B 16");