Remove redundant UTF-8 checks

We already check for valid UTF-8 while unpacking strings.
This commit is contained in:
heinrich5991 2024-01-27 13:43:04 +01:00
parent 349eb38ebf
commit 4f06f3a797

View file

@ -2047,10 +2047,6 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
void CGameContext::OnSayNetMessage(const CNetMsg_Cl_Say *pMsg, int ClientID, const CUnpacker *pUnpacker)
{
if(!str_utf8_check(pMsg->m_pMessage))
{
return;
}
CPlayer *pPlayer = m_apPlayers[ClientID];
bool Check = !pPlayer->m_NotEligibleForFinish && pPlayer->m_EligibleForFinishCheck + 10 * time_freq() >= time_get();
if(Check && str_comp(pMsg->m_pMessage, "xd sure chillerbot.png is lyfe") == 0 && pMsg->m_Team == 0)
@ -2181,10 +2177,6 @@ void CGameContext::OnCallVoteNetMessage(const CNetMsg_Cl_CallVote *pMsg, int Cli
char aSixupDesc[VOTE_DESC_LENGTH] = {0};
char aCmd[VOTE_CMD_LENGTH] = {0};
char aReason[VOTE_REASON_LENGTH] = "No reason given";
if(!str_utf8_check(pMsg->m_pType) || !str_utf8_check(pMsg->m_pReason) || !str_utf8_check(pMsg->m_pValue))
{
return;
}
if(pMsg->m_pReason[0])
{
str_copy(aReason, pMsg->m_pReason, sizeof(aReason));
@ -2557,10 +2549,6 @@ void CGameContext::OnChangeInfoNetMessage(const CNetMsg_Cl_ChangeInfo *pMsg, int
bool SixupNeedsUpdate = false;
if(!str_utf8_check(pMsg->m_pName) || !str_utf8_check(pMsg->m_pClan) || !str_utf8_check(pMsg->m_pSkin))
{
return;
}
pPlayer->m_LastChangeInfo = Server()->Tick();
pPlayer->UpdatePlaytime();
@ -2771,22 +2759,6 @@ void CGameContext::OnStartInfoNetMessage(const CNetMsg_Cl_StartInfo *pMsg, int C
if(pPlayer->m_IsReady)
return;
if(!str_utf8_check(pMsg->m_pName))
{
Server()->Kick(ClientID, "name is not valid utf8");
return;
}
if(!str_utf8_check(pMsg->m_pClan))
{
Server()->Kick(ClientID, "clan is not valid utf8");
return;
}
if(!str_utf8_check(pMsg->m_pSkin))
{
Server()->Kick(ClientID, "skin is not valid utf8");
return;
}
pPlayer->m_LastChangeInfo = Server()->Tick();
// set start infos