2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-02-05 02:00:34 +03:00

SV_New_f: Deny new connection twice at a time if user messages are received

SV_ReadClientMessage: Fix empty names on bad read
This commit is contained in:
s1lentq 2021-06-16 04:21:25 +07:00
parent f3d60248fa
commit 3a9bfb9ca1
2 changed files with 11 additions and 2 deletions

View File

@ -1498,7 +1498,7 @@ void SV_New_f(void)
return;
}
if (!host_client->active && host_client->spawned)
if ((host_client->hasusrmsgs && host_client->m_bSentNewResponse) || (!host_client->active && host_client->spawned))
{
return;
}
@ -1564,6 +1564,7 @@ void SV_New_f(void)
}
Netchan_CreateFragments(TRUE, &host_client->netchan, &msg);
Netchan_FragSend(&host_client->netchan);
host_client->m_bSentNewResponse = TRUE;
}
void SV_SendRes_f(void)
@ -7371,6 +7372,8 @@ void SV_InactivateClients(void)
cl->connected = TRUE;
cl->spawned = FALSE;
cl->fully_connected = FALSE;
cl->hasusrmsgs = FALSE;
cl->m_bSentNewResponse = FALSE;
SZ_Clear(&cl->netchan.message);
SZ_Clear(&cl->datagram);

View File

@ -1779,6 +1779,12 @@ void EXT_FUNC SV_HandleClientMessage_api(IGameClient* client, uint8 opcode) {
return;
}
#ifdef REHLDS_FIXES
// Save current name of the client before a possible kick
char name[32];
Q_strlcpy(name, host_client->name);
#endif
void(*func)(client_t *) = sv_clcfuncs[opcode].pfnParse;
if (func)
func(cl);
@ -1786,7 +1792,7 @@ void EXT_FUNC SV_HandleClientMessage_api(IGameClient* client, uint8 opcode) {
#ifdef REHLDS_FIXES
if (msg_badread)
{
Con_Printf("SV_ReadClientMessage: badread on %s, opcode %s\n", host_client->name, sv_clcfuncs[opcode].pszname);
Con_Printf("SV_ReadClientMessage: badread on %s, opcode %s\n", name, sv_clcfuncs[opcode].pszname);
}
#endif