Skip to content

Commit

Permalink
Realmd/Core: Adjust username length to proper max length allowed duri…
Browse files Browse the repository at this point in the history
…ng creation
  • Loading branch information
killerwife committed Feb 4, 2024
1 parent 976614c commit 8c55e0a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/realmd/AuthSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ enum SecurityFlags
#pragma pack(push,1)
#endif

# define AUTH_LOGON_MAX_NAME 16

struct sAuthLogonChallengeBody
{
uint8 gamename[4];
Expand All @@ -76,7 +78,7 @@ struct sAuthLogonChallengeBody
uint32 timezone_bias;
uint32 ip;
uint8 userName_len;
uint8 userName[11];
uint8 userName[AUTH_LOGON_MAX_NAME + 1];
};

struct sAuthLogonChallengeHeader
Expand Down Expand Up @@ -323,7 +325,7 @@ bool AuthSocket::_HandleLogonChallenge()
EndianConvert(*pUint16);
uint16 remaining = header->size;

if ((remaining < sizeof(sAuthLogonChallengeBody) - 10))
if ((remaining < sizeof(sAuthLogonChallengeBody) - AUTH_LOGON_MAX_NAME))
return;

DEBUG_LOG("[AuthChallenge] got header, body is %#04x bytes", remaining);
Expand All @@ -337,7 +339,7 @@ bool AuthSocket::_HandleLogonChallenge()
{
if (error) return;

if (body->userName_len > 10)
if (body->userName_len > AUTH_LOGON_MAX_NAME)
return;

body->userName[body->userName_len] = '\0';
Expand Down

0 comments on commit 8c55e0a

Please sign in to comment.