Merge pull request #2868 from bibo38/namelength
Limited the username length to 16 characters.
This commit is contained in:
commit
4513f88a64
@ -1719,6 +1719,12 @@ bool cClientHandle::CheckMultiLogin(const AString & a_Username)
|
||||
|
||||
bool cClientHandle::HandleHandshake(const AString & a_Username)
|
||||
{
|
||||
if (a_Username.length() > 16)
|
||||
{
|
||||
Kick("Your username is too long(>16 characters)");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!cRoot::Get()->GetPluginManager()->CallHookHandshake(*this, a_Username))
|
||||
{
|
||||
if (cRoot::Get()->GetServer()->GetNumPlayers() >= cRoot::Get()->GetServer()->GetMaxPlayers())
|
||||
|
@ -89,6 +89,8 @@ cPlayer::cPlayer(cClientHandlePtr a_Client, const AString & a_PlayerName) :
|
||||
m_UUID((a_Client != nullptr) ? a_Client->GetUUID() : ""),
|
||||
m_CustomName("")
|
||||
{
|
||||
ASSERT(a_PlayerName.length() <= 16); // Otherwise this player could crash many clients...
|
||||
|
||||
m_InventoryWindow = new cInventoryWindow(*this);
|
||||
m_CurrentWindow = m_InventoryWindow;
|
||||
m_InventoryWindow->OpenedByPlayer(*this);
|
||||
|
Loading…
x
Reference in New Issue
Block a user