aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL
diff options
context:
space:
mode:
Diffstat (limited to 'NorthstarDLL')
-rw-r--r--NorthstarDLL/NorthstarDLL.vcxproj1
-rw-r--r--NorthstarDLL/NorthstarDLL.vcxproj.filters3
-rw-r--r--NorthstarDLL/server/servernethooks.cpp16
-rw-r--r--NorthstarDLL/shared/exploit_fixes/ns_limits.cpp7
-rw-r--r--NorthstarDLL/shared/exploit_fixes/ns_limits.h1
5 files changed, 23 insertions, 5 deletions
diff --git a/NorthstarDLL/NorthstarDLL.vcxproj b/NorthstarDLL/NorthstarDLL.vcxproj
index da6ed9cd..f2607a82 100644
--- a/NorthstarDLL/NorthstarDLL.vcxproj
+++ b/NorthstarDLL/NorthstarDLL.vcxproj
@@ -530,6 +530,7 @@
<ClCompile Include="server\buildainfile.cpp" />
<ClCompile Include="server\r2server.cpp" />
<ClCompile Include="server\serverchathooks.cpp" />
+ <ClCompile Include="server\servernethooks.cpp" />
<ClCompile Include="server\serverpresence.cpp" />
<ClCompile Include="shared\exploit_fixes\exploitfixes.cpp" />
<ClCompile Include="shared\exploit_fixes\exploitfixes_lzss.cpp" />
diff --git a/NorthstarDLL/NorthstarDLL.vcxproj.filters b/NorthstarDLL/NorthstarDLL.vcxproj.filters
index 4be3288b..503caa63 100644
--- a/NorthstarDLL/NorthstarDLL.vcxproj.filters
+++ b/NorthstarDLL/NorthstarDLL.vcxproj.filters
@@ -1453,6 +1453,9 @@
<ClCompile Include="server\alltalk.cpp">
<Filter>Source Files\server</Filter>
</ClCompile>
+ <ClCompile Include="server\servernethooks.cpp">
+ <Filter>Source Files\server</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<MASM Include="audio_asm.asm">
diff --git a/NorthstarDLL/server/servernethooks.cpp b/NorthstarDLL/server/servernethooks.cpp
new file mode 100644
index 00000000..c5f4f75f
--- /dev/null
+++ b/NorthstarDLL/server/servernethooks.cpp
@@ -0,0 +1,16 @@
+#include "engine/r2engine.h"
+#include "shared/exploit_fixes/ns_limits.h"
+
+AUTOHOOK_INIT()
+
+AUTOHOOK(ProcessConnectionlessPacket, engine.dll + 0x117800, bool, , (void* a1, R2::netpacket_t* packet))
+{
+ if (!g_pServerLimits->CheckConnectionlessPacketLimits(packet))
+ return false;
+ return ProcessConnectionlessPacket(a1, packet);
+}
+
+ON_DLL_LOAD_RELIESON("engine.dll", ServerNetHooks, ConVar, (CModule module))
+{
+ AUTOHOOK_DISPATCH_MODULE(engine.dll)
+}
diff --git a/NorthstarDLL/shared/exploit_fixes/ns_limits.cpp b/NorthstarDLL/shared/exploit_fixes/ns_limits.cpp
index 35756044..e69ef41c 100644
--- a/NorthstarDLL/shared/exploit_fixes/ns_limits.cpp
+++ b/NorthstarDLL/shared/exploit_fixes/ns_limits.cpp
@@ -144,10 +144,7 @@ char, __fastcall, (void* self, void* buf))
return ret;
}
-// clang-format off
-AUTOHOOK(ProcessConnectionlessPacket, engine.dll + 0x117800,
-bool, , (void* a1, R2::netpacket_t* packet))
-// clang-format on
+bool ServerLimitsManager::CheckConnectionlessPacketLimits(R2::netpacket_t* packet)
{
static const ConVar* Cvar_net_data_block_enabled = R2::g_pCVar->FindVar("net_data_block_enabled");
@@ -196,7 +193,7 @@ bool, , (void* a1, R2::netpacket_t* packet))
}
}
- return ProcessConnectionlessPacket(a1, packet);
+ return true;
}
// this is weird and i'm not sure if it's correct, so not using for now
diff --git a/NorthstarDLL/shared/exploit_fixes/ns_limits.h b/NorthstarDLL/shared/exploit_fixes/ns_limits.h
index bbc0a85f..d1f7f2ed 100644
--- a/NorthstarDLL/shared/exploit_fixes/ns_limits.h
+++ b/NorthstarDLL/shared/exploit_fixes/ns_limits.h
@@ -46,6 +46,7 @@ class ServerLimitsManager
void RemovePlayer(R2::CBaseClient* player);
bool CheckStringCommandLimits(R2::CBaseClient* player);
bool CheckChatLimits(R2::CBaseClient* player);
+ bool CheckConnectionlessPacketLimits(R2::netpacket_t* packet);
};
extern ServerLimitsManager* g_pServerLimits;