[Network]: Check who sent print OOB (#969)
This commit is contained in:
parent
b33d5912a9
commit
f8acea54d8
@ -22,7 +22,7 @@ namespace Components
|
|||||||
|
|
||||||
void Logger::Print_Stub(const int channel, const char* message, ...)
|
void Logger::Print_Stub(const int channel, const char* message, ...)
|
||||||
{
|
{
|
||||||
char buf[4096] = {0};
|
char buf[4096]{};
|
||||||
|
|
||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, message);
|
va_start(va, message);
|
||||||
|
@ -360,9 +360,13 @@ namespace Components
|
|||||||
Utils::Hook::Set<std::uint8_t>(0x5AA5B6, 0xEB); // CL_SteamServerAuth
|
Utils::Hook::Set<std::uint8_t>(0x5AA5B6, 0xEB); // CL_SteamServerAuth
|
||||||
Utils::Hook::Set<std::uint8_t>(0x5AA69F, 0xEB); // echo
|
Utils::Hook::Set<std::uint8_t>(0x5AA69F, 0xEB); // echo
|
||||||
Utils::Hook::Set<std::uint8_t>(0x5AAA82, 0xEB); // SP
|
Utils::Hook::Set<std::uint8_t>(0x5AAA82, 0xEB); // SP
|
||||||
|
Utils::Hook::Set<std::uint8_t>(0x5A9F77, 0xEB); // CL_WeNowCantHearSomeone
|
||||||
Utils::Hook::Set<std::uint8_t>(0x5A9F18, 0xEB); // CL_VoiceConnectionTestPacket
|
Utils::Hook::Set<std::uint8_t>(0x5A9F18, 0xEB); // CL_VoiceConnectionTestPacket
|
||||||
Utils::Hook::Set<std::uint8_t>(0x5A9FF3, 0xEB); // CL_HandleRelayPacket
|
Utils::Hook::Set<std::uint8_t>(0x5A9FF3, 0xEB); // CL_HandleRelayPacket
|
||||||
|
|
||||||
|
// For security reasons check the sender of the 'print' OOB
|
||||||
|
Utils::Hook::Set<std::uint8_t>(0x5AA729, 0xEB);
|
||||||
|
|
||||||
// Com_GetProtocol
|
// Com_GetProtocol
|
||||||
Utils::Hook::Set<std::uint32_t>(0x4FB501, PROTOCOL);
|
Utils::Hook::Set<std::uint32_t>(0x4FB501, PROTOCOL);
|
||||||
|
|
||||||
@ -381,9 +385,24 @@ namespace Components
|
|||||||
Utils::Hook::Set<std::uint8_t>(0x682170, 0xC3); // Telling LSP that we're playing a private match
|
Utils::Hook::Set<std::uint8_t>(0x682170, 0xC3); // Telling LSP that we're playing a private match
|
||||||
Utils::Hook::Nop(0x4FD448, 5); // Don't create lsp_socket
|
Utils::Hook::Nop(0x4FD448, 5); // Don't create lsp_socket
|
||||||
|
|
||||||
OnClientPacket("resolveAddress", [](const Address& address, [[maybe_unused]] const std::string& data)
|
OnClientPacket("resolveAddress", []([[maybe_unused]] const Address& address, [[maybe_unused]] const std::string& data)
|
||||||
{
|
{
|
||||||
SendRaw(address, address.getString());
|
SendRaw(address, address.getString());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
OnClientPacket("print", []([[maybe_unused]] const Address& address, [[maybe_unused]] const std::string& data)
|
||||||
|
{
|
||||||
|
auto* clc = Game::CL_GetLocalClientConnection(0);
|
||||||
|
if (!Game::NET_CompareBaseAdr(clc->serverAddress, *address.get()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
char buffer[2048]{};
|
||||||
|
|
||||||
|
Game::I_strncpyz(clc->serverMessage, data.data(), sizeof(clc->serverMessage));
|
||||||
|
Game::Com_sprintf(buffer, sizeof(buffer), "%s", data.data());
|
||||||
|
Game::Com_PrintMessage(Game::CON_CHANNEL_CLIENT, data.data(), 0);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ namespace Game
|
|||||||
Com_PrintError_t Com_PrintError = Com_PrintError_t(0x4F8C70);
|
Com_PrintError_t Com_PrintError = Com_PrintError_t(0x4F8C70);
|
||||||
Com_PrintWarning_t Com_PrintWarning = Com_PrintWarning_t(0x4E0200);
|
Com_PrintWarning_t Com_PrintWarning = Com_PrintWarning_t(0x4E0200);
|
||||||
Com_PrintMessage_t Com_PrintMessage = Com_PrintMessage_t(0x4AA830);
|
Com_PrintMessage_t Com_PrintMessage = Com_PrintMessage_t(0x4AA830);
|
||||||
|
Com_sprintf_t Com_sprintf = Com_sprintf_t(0x413DE0);
|
||||||
Com_EndParseSession_t Com_EndParseSession = Com_EndParseSession_t(0x4B80B0);
|
Com_EndParseSession_t Com_EndParseSession = Com_EndParseSession_t(0x4B80B0);
|
||||||
Com_BeginParseSession_t Com_BeginParseSession = Com_BeginParseSession_t(0x4AAB80);
|
Com_BeginParseSession_t Com_BeginParseSession = Com_BeginParseSession_t(0x4AAB80);
|
||||||
Com_ParseOnLine_t Com_ParseOnLine = Com_ParseOnLine_t(0x4C0350);
|
Com_ParseOnLine_t Com_ParseOnLine = Com_ParseOnLine_t(0x4C0350);
|
||||||
|
@ -29,6 +29,9 @@ namespace Game
|
|||||||
typedef void(*Com_PrintMessage_t)(int channel, const char* msg, int error);
|
typedef void(*Com_PrintMessage_t)(int channel, const char* msg, int error);
|
||||||
extern Com_PrintMessage_t Com_PrintMessage;
|
extern Com_PrintMessage_t Com_PrintMessage;
|
||||||
|
|
||||||
|
typedef int(*Com_sprintf_t)(char* dest, int size, const char* fmt, ...);
|
||||||
|
extern Com_sprintf_t Com_sprintf;
|
||||||
|
|
||||||
typedef void(*Com_EndParseSession_t)();
|
typedef void(*Com_EndParseSession_t)();
|
||||||
extern Com_EndParseSession_t Com_EndParseSession;
|
extern Com_EndParseSession_t Com_EndParseSession;
|
||||||
|
|
||||||
|
@ -109,6 +109,7 @@ namespace Game
|
|||||||
|
|
||||||
NET_AdrToString_t NET_AdrToString = NET_AdrToString_t(0x469880);
|
NET_AdrToString_t NET_AdrToString = NET_AdrToString_t(0x469880);
|
||||||
NET_CompareAdr_t NET_CompareAdr = NET_CompareAdr_t(0x4D0AA0);
|
NET_CompareAdr_t NET_CompareAdr = NET_CompareAdr_t(0x4D0AA0);
|
||||||
|
NET_CompareBaseAdr_t NET_CompareBaseAdr = NET_CompareBaseAdr_t(0x455510);
|
||||||
NET_DeferPacketToClient_t NET_DeferPacketToClient = NET_DeferPacketToClient_t(0x4C8AA0);
|
NET_DeferPacketToClient_t NET_DeferPacketToClient = NET_DeferPacketToClient_t(0x4C8AA0);
|
||||||
NET_ErrorString_t NET_ErrorString = NET_ErrorString_t(0x4E7720);
|
NET_ErrorString_t NET_ErrorString = NET_ErrorString_t(0x4E7720);
|
||||||
NET_Init_t NET_Init = NET_Init_t(0x491860);
|
NET_Init_t NET_Init = NET_Init_t(0x491860);
|
||||||
|
@ -269,12 +269,15 @@ namespace Game
|
|||||||
typedef void(*NetadrToSockadr_t)(netadr_t *a, sockaddr *s);
|
typedef void(*NetadrToSockadr_t)(netadr_t *a, sockaddr *s);
|
||||||
extern NetadrToSockadr_t NetadrToSockadr;
|
extern NetadrToSockadr_t NetadrToSockadr;
|
||||||
|
|
||||||
typedef const char* (*NET_AdrToString_t)(netadr_t adr);
|
typedef const char*(*NET_AdrToString_t)(netadr_t adr);
|
||||||
extern NET_AdrToString_t NET_AdrToString;
|
extern NET_AdrToString_t NET_AdrToString;
|
||||||
|
|
||||||
typedef bool(*NET_CompareAdr_t)(netadr_t a, netadr_t b);
|
typedef bool(*NET_CompareAdr_t)(netadr_t a, netadr_t b);
|
||||||
extern NET_CompareAdr_t NET_CompareAdr;
|
extern NET_CompareAdr_t NET_CompareAdr;
|
||||||
|
|
||||||
|
typedef int(*NET_CompareBaseAdr_t)(netadr_t a, netadr_t b);
|
||||||
|
extern NET_CompareBaseAdr_t NET_CompareBaseAdr;
|
||||||
|
|
||||||
typedef void(*NET_DeferPacketToClient_t)(netadr_t*, msg_t*);
|
typedef void(*NET_DeferPacketToClient_t)(netadr_t*, msg_t*);
|
||||||
extern NET_DeferPacketToClient_t NET_DeferPacketToClient;
|
extern NET_DeferPacketToClient_t NET_DeferPacketToClient;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user