Skip to content

Commit

Permalink
Revert "Log invalid CDKey validation challenge respond and disconnect…
Browse files Browse the repository at this point in the history
… its sender."

This reverts commit 7189e5a.
  • Loading branch information
Xottab-DUTY committed Mar 31, 2019
1 parent 794976d commit 9a64a3c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
14 changes: 4 additions & 10 deletions cs/engine/xrGame/xrGameSpyServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,24 +166,18 @@ u32 xrGameSpyServer::OnMessage(NET_Packet& P, ClientID sender) // Non-Zero
case M_GAMESPY_CDKEY_VALIDATION_CHALLENGE_RESPOND:
{
string128 ResponseStr;
ResponseStr[0] = 0;
if ((P.r_elapsed() == 0) ||
(P.r_elapsed() >= sizeof(ResponseStr)))
{
auto clientIp = CL->m_cAddress.to_string();
Msg("! WARNING: Validation challenge respond from client [%s] is too long, DoS attack?", clientIp.c_str());
this->DisconnectClient(CL, "");
// XXX nitrocaster: block IP address after X such attempts
return 0;
}
}
strcpy_s(ResponseStr, "");
P.r_stringZ(ResponseStr);
if (xr_strlen(ResponseStr) == 0)
{
auto clientIp = CL->m_cAddress.to_string();
Msg("! WARNING: Validation challenge respond from client [%s] is empty, DoS attack?", clientIp.c_str());
this->DisconnectClient(CL, "");
return 0;
}
}

if (!CL->m_bCDKeyAuth)
{
#ifndef MASTER_GOLD
Expand Down
2 changes: 1 addition & 1 deletion cs/engine/xrNetServer/NET_Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void ip_address::set(LPCSTR src_string)
}
}

xr_string ip_address::to_string() const // XXX nitrocaster: don't use xr_string here
xr_string ip_address::to_string() const
{
string128 res;
sprintf_s (res,sizeof(res),"%d.%d.%d.%d", m_data.a1, m_data.a2, m_data.a3, m_data.a4);
Expand Down

0 comments on commit 9a64a3c

Please sign in to comment.