Skip to content

Commit 614638d

Browse files
committed
Reliability fixes for nickname valid-checks on client and server
Fix 1: Backtick validation gap (client) Added strchr(szNick, '') != nullptrcheck to the client's CheckNickProvided, matching the server's version in Shared/Utils.cpp. Previously, a nickname containing a backtick passed all client-side checks, was serialized correctly, and then got rejected server-side with INVALID_NICKNAME. Fix 2: Unchecked ReadString (server) Added return-value check on BitStream.ReadString(m_strPlayerVersion). If this read fails (corrupted length prefix from a shifted bitstream), it now returns false immediately instead of continung to parse the nickname and subsequent fields from a wrong offset. This prevents garbage data from being interpreted as the nickname and triggering an incorrect INVALID_NICKNAME.
1 parent 8b61ad0 commit 614638d

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

Client/core/CConnectManager.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,8 @@ bool CConnectManager::CheckNickProvided(const char* szNick)
450450
return false;
451451
if (stricmp(szNick, "server") == 0)
452452
return false;
453+
if (strchr(szNick, '`') != nullptr)
454+
return false;
453455
return true;
454456
}
455457

Server/mods/deathmatch/logic/packets/CPlayerJoinDataPacket.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ bool CPlayerJoinDataPacket::Read(NetBitStreamInterface& BitStream)
2121
if (!BitStream.Read(m_usBitStreamVersion))
2222
return false;
2323

24-
BitStream.ReadString(m_strPlayerVersion);
24+
if (!BitStream.ReadString(m_strPlayerVersion))
25+
return false;
2526

2627
m_bOptionalUpdateInfoRequired = BitStream.ReadBit();
2728

0 commit comments

Comments
 (0)