r5sdk/r5dev/engine/client/cl_ents_parse.cpp
Kawe Mazidjatari a618990937 Detour code refactor
This change was planned for a long time. This moves all REGISTER calls to a single translation unit, this is required as we currently added a very dirty workaround for not registering duplicates by checking if VFTable pointer was already present in the vector... Registering from single translation unit prevents duplicate instances that gets created if header is included by more cpp files.
Reworking this reduced 100kb+ of compiled code. This commit also reworked the way functions/variables/constant gets logged with their addresses; the new code formats them on the fly, and allows for resize at any time. Formatting is no longer required by programmer.

TODO: currently there are some compile errors for dedicated and client dll's. These will be resolved very soon as they need to be properly worked out still (server & client only stuff needs to be properly split). Use the 'main' (stable) branch for the time being if you need to compile these dll's.
2023-01-25 02:26:52 +01:00

27 lines
918 B
C++
Raw Blame History

//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======//
//
// Purpose: Parsing of entity network packets.
//
// $NoKeywords: $
//=============================================================================//
#include "core/stdafx.h"
#include "public/const.h"
#include "engine/client/cl_ents_parse.h"
bool CL_CopyExistingEntity(__int64 a1, unsigned int* a2, char* a3)
{
int nNewEntity = *reinterpret_cast<int*>(a1 + 40);
if (nNewEntity >= MAX_EDICTS || nNewEntity < NULL)
{
// Value isn't sanitized in release builds for
// every game powered by the Source Engine 1
// causing read/write outside of array bounds.
// This defect has let to the achievement of a
// full-chain RCE exploit. We hook and perform
// sanity checks for the value of m_nNewEntity
// here to prevent this behavior from happening.
return false;
}
return v_CL_CopyExistingEntity(a1, a2, a3);
}