Skip to content

Commit

Permalink
Fix potential buffer overflow in xrGameSpyServer::OnMessage.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Kovalenko committed Oct 9, 2014
1 parent 9bef2c2 commit 99de510
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/xrGame/xrGameSpyServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,18 @@ u32 xrGameSpyServer::OnMessage(NET_Packet& P, ClientID sender) // Non-Zero
{
case M_GAMESPY_CDKEY_VALIDATION_CHALLENGE_RESPOND:
{
string128 ResponseStr;
P.r_stringZ(ResponseStr);

string128 ResponseStr = "";
u32 bytesRemain = P.r_elapsed();
if (bytesRemain == 0 || bytesRemain > sizeof(ResponseStr))
{
xr_string clientIp = CL->m_cAddress.to_string();
Msg("! WARNING: Validation challenge respond from client [%s] is %s. DoS attack?",
clientIp.c_str(), bytesRemain == 0 ? "empty" : "too long");
DisconnectClient(CL, "");
// XXX nitrocaster: block IP address after X such attempts

This comment has been minimized.

Copy link
@Xottab-DUTY

Xottab-DUTY Mar 9, 2019

Member

This XXX is done in f732f78

return 0;
}
P.r_stringZ(ResponseStr);
if (!CL->m_bCDKeyAuth)
{
#ifndef MASTER_GOLD
Expand Down

0 comments on commit 99de510

Please sign in to comment.