From 37e50708b78fdbe27174ed550ef90dd67c3d7422 Mon Sep 17 00:00:00 2001 From: apathy Date: Thu, 4 Aug 2016 11:23:47 -0700 Subject: [PATCH] Only resize if length is longer than max_account_name_length --- .../application/LoginServer/src/shared/ClientConnection.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 37c93d58..82aa6b38 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -175,7 +175,10 @@ void ClientConnection::validateClient(const std::string & id, const std::string // to avoid having to re-type this stupid var all over the place // ideally we wouldn't copy this here, but it would be a huge pain std::string tmp = trim(id); - tmp.resize(MAX_ACCOUNT_NAME_LENGTH); // truncate name after the trim + + if (tmp.length() > MAX_ACCOUNT_NAME_LENGTH) { + tmp.resize(MAX_ACCOUNT_NAME_LENGTH); // truncate name after the trim + } const std::string trimmedId = tmp; const std::string trimmedKey = trim(key);