Limit max user name length for offline account in server

This commit is contained in:
Benau 2020-05-23 13:35:05 +08:00
parent 92b40a986f
commit f316a83c63

View File

@ -3547,8 +3547,11 @@ void ServerLobby::handleUnencryptedConnection(std::shared_ptr<STKPeer> peer,
{
core::stringw name;
data.decodeStringW(&name);
// 30 to make it consistent with stk-addons max user name length
if (name.empty())
name = L"unnamed";
else if (name.size() > 30)
name = name.subString(0, 30);
float default_kart_color = data.getFloat();
HandicapLevel handicap = (HandicapLevel)data.getUInt8();
auto player = std::make_shared<NetworkPlayerProfile>