mirror of
https://github.com/rehlds/rehlds.git
synced 2025-01-04 02:55:50 +03:00
Update sv_user.cpp
This commit is contained in:
parent
ae3ae6ef2b
commit
665cf9f557
@ -92,17 +92,17 @@ void SV_ParseConsistencyResponse(client_t *pSenderClient)
|
|||||||
int length = 0;
|
int length = 0;
|
||||||
int c = 0;
|
int c = 0;
|
||||||
Q_memset(nullbuffer, 0, sizeof(nullbuffer));
|
Q_memset(nullbuffer, 0, sizeof(nullbuffer));
|
||||||
int value = MSG_ReadShort();
|
int mlen = MSG_ReadShort();
|
||||||
|
|
||||||
if (sv_invalid_length.value && value <= 0 || !SZ_HasSomethingToRead(&net_message, value))
|
if (sv_invalid_length.value != 0.0f && mlen <= 0 || !SZ_HasSomethingToRead(&net_message, mlen))
|
||||||
{
|
{
|
||||||
msg_badread = TRUE;
|
msg_badread = TRUE;
|
||||||
Con_DPrintf("%s: %s:%s invalid length: %d\n", __func__, host_client->name, NET_AdrToString(host_client->netchan.remote_address), value);
|
Con_DPrintf("%s: %s:%s invalid length: %d\n", __func__, host_client->name, NET_AdrToString(host_client->netchan.remote_address), mlen);
|
||||||
SV_DropClient(host_client, FALSE, "Invalid length");
|
SV_DropClient(host_client, FALSE, "Invalid length");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
COM_UnMunge(&net_message.data[msg_readcount], value, g_psvs.spawncount);
|
COM_UnMunge(&net_message.data[msg_readcount], mlen, g_psvs.spawncount);
|
||||||
MSG_StartBitReading(&net_message);
|
MSG_StartBitReading(&net_message);
|
||||||
|
|
||||||
while (MSG_ReadBits(1))
|
while (MSG_ReadBits(1))
|
||||||
@ -1572,7 +1572,7 @@ void SV_ParseMove(client_t *pSenderClient)
|
|||||||
mlen = MSG_ReadByte();
|
mlen = MSG_ReadByte();
|
||||||
cbchecksum = MSG_ReadByte();
|
cbchecksum = MSG_ReadByte();
|
||||||
|
|
||||||
if (sv_invalid_length.value && mlen <= 0 || !SZ_HasSpaceToRead(&net_message, mlen))
|
if (sv_invalid_length.value != 0.0f && mlen <= 0 || !SZ_HasSpaceToRead(&net_message, mlen))
|
||||||
{
|
{
|
||||||
msg_badread = TRUE;
|
msg_badread = TRUE;
|
||||||
Con_DPrintf("%s: %s:%s invalid length: %d\n", __func__, host_client->name, NET_AdrToString(host_client->netchan.remote_address), mlen);
|
Con_DPrintf("%s: %s:%s invalid length: %d\n", __func__, host_client->name, NET_AdrToString(host_client->netchan.remote_address), mlen);
|
||||||
@ -1787,7 +1787,7 @@ void EXT_FUNC SV_HandleClientMessage_api(IGameClient* client, uint8 opcode) {
|
|||||||
static_assert(REHLDS_API_VERSION_MAJOR <= 3, "Bump major API DETECTED!! You shall rework the hookchain, make function returnable");
|
static_assert(REHLDS_API_VERSION_MAJOR <= 3, "Bump major API DETECTED!! You shall rework the hookchain, make function returnable");
|
||||||
msg_badread = 1;
|
msg_badread = 1;
|
||||||
|
|
||||||
if (sv_msg_badread.value)
|
if (sv_msg_badread.value != 0.0f)
|
||||||
{
|
{
|
||||||
Con_Printf("SV_ReadClientMessage: unknown command char (%d)\n", opcode);
|
Con_Printf("SV_ReadClientMessage: unknown command char (%d)\n", opcode);
|
||||||
}
|
}
|
||||||
@ -1807,7 +1807,7 @@ void EXT_FUNC SV_HandleClientMessage_api(IGameClient* client, uint8 opcode) {
|
|||||||
func(cl);
|
func(cl);
|
||||||
|
|
||||||
#ifdef REHLDS_FIXES
|
#ifdef REHLDS_FIXES
|
||||||
if (msg_badread && sv_msg_badread.value)
|
if (msg_badread && sv_msg_badread.value != 0.0f)
|
||||||
{
|
{
|
||||||
Con_Printf("SV_ReadClientMessage: badread on %s, opcode %s\n", name, sv_clcfuncs[opcode].pszname);
|
Con_Printf("SV_ReadClientMessage: badread on %s, opcode %s\n", name, sv_clcfuncs[opcode].pszname);
|
||||||
}
|
}
|
||||||
@ -1835,7 +1835,7 @@ void SV_ExecuteClientMessage(client_t *cl)
|
|||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (msg_badread && sv_msg_badread.value)
|
if (msg_badread && sv_msg_badread.value != 0.0f)
|
||||||
{
|
{
|
||||||
#ifdef REHLDS_FIXES
|
#ifdef REHLDS_FIXES
|
||||||
Con_Printf("SV_ReadClientMessage: badread on %s\n", host_client->name);
|
Con_Printf("SV_ReadClientMessage: badread on %s\n", host_client->name);
|
||||||
|
Loading…
Reference in New Issue
Block a user