From 41aa7cf1232941ebe13efb6f64439d38963beb22 Mon Sep 17 00:00:00 2001 From: bibo38 Date: Wed, 13 Jan 2016 07:55:05 +0100 Subject: Limited the username length to 16 characters. This fixes a client crash, because Minecraft requires that a username is not longer than 16 characters. See also: http://minecraft.gamepedia.com/The_Player#Name Fixes #2545 --- src/ClientHandle.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/ClientHandle.cpp') 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()) -- cgit v1.2.3