diff options
author | Mattes D <github@xoft.cz> | 2016-01-13 10:21:48 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2016-01-13 10:21:48 +0100 |
commit | 4513f88a643e847a7be2cf5bd4f80532ec36dd81 (patch) | |
tree | 6b9b590244eaa7373e73c249c4b315028b2ef548 /src | |
parent | Merge pull request #2867 from LogicParrot/compile2 (diff) | |
parent | Limited the username length to 16 characters. (diff) | |
download | cuberite-4513f88a643e847a7be2cf5bd4f80532ec36dd81.tar cuberite-4513f88a643e847a7be2cf5bd4f80532ec36dd81.tar.gz cuberite-4513f88a643e847a7be2cf5bd4f80532ec36dd81.tar.bz2 cuberite-4513f88a643e847a7be2cf5bd4f80532ec36dd81.tar.lz cuberite-4513f88a643e847a7be2cf5bd4f80532ec36dd81.tar.xz cuberite-4513f88a643e847a7be2cf5bd4f80532ec36dd81.tar.zst cuberite-4513f88a643e847a7be2cf5bd4f80532ec36dd81.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/ClientHandle.cpp | 6 | ||||
-rw-r--r-- | src/Entities/Player.cpp | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index 0f1164a1e..377a84ce9 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -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()) diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index c5a1e0f95..766161703 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -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); |