From 1e0c9eabe3e5848bc029569b292dce3ab7034a64 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Thu, 30 Jul 2020 11:50:31 +0200 Subject: [PATCH] Fixed some too long messages --- git-teaspeak | 2 +- server/src/client/SpeakingClient.cpp | 6 ++++++ server/src/client/command_handler/client.cpp | 11 +++++++++-- shared | 2 +- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/git-teaspeak b/git-teaspeak index e608751..d75ecb6 160000 --- a/git-teaspeak +++ b/git-teaspeak @@ -1 +1 @@ -Subproject commit e6087512662f5bed71a47b45b1824fc78d27aeda +Subproject commit d75ecb67041c3b9958d75848c253e35774d36578 diff --git a/server/src/client/SpeakingClient.cpp b/server/src/client/SpeakingClient.cpp index 764901d..51511de 100644 --- a/server/src/client/SpeakingClient.cpp +++ b/server/src/client/SpeakingClient.cpp @@ -494,6 +494,12 @@ command_result SpeakingClient::handleCommandClientInit(Command& cmd) { logWarning(this->getServerId(), "{} Tried to join within an invalid supplied '{}' ({})", CLIENT_STR_LOG_PREFIX, key,cmd[key].string()); return command_result{error::client_hacked}; } + } else if(key == "client_talk_request_msg") { + if(cmd["client_talk_request_msg"].string().length() > 50) + return command_result{error::parameter_invalid_size, "client_talk_request_msg"}; + } else if(key == "client_away_message") { + if(cmd["client_away_message"].string().length() > ts::kMaxAfkMessageLength) + return command_result{error::parameter_invalid_size, "client_away_message"}; } const auto &info = property::find(key); diff --git a/server/src/client/command_handler/client.cpp b/server/src/client/command_handler/client.cpp index c6285c4..74c6975 100644 --- a/server/src/client/command_handler/client.cpp +++ b/server/src/client/command_handler/client.cpp @@ -323,8 +323,12 @@ command_result ConnectedClient::handleCommandClientPoke(Command &cmd) { return command_result{permission::i_client_poke_max_clients}; } + auto message = cmd["msg"].string(); + if(count_characters(message) > 100) + return command_result{error::parameter_invalid_size, "msg"}; + for(auto& client : clients) - client->notifyClientPoke(_this.lock(), cmd["msg"]); + client->notifyClientPoke(_this.lock(), message); return command_result{std::forward(result)}; } @@ -697,10 +701,13 @@ command_result ConnectedClient::handleCommandClientEdit(Command &cmd, const std: } else if(info == property::CLIENT_AWAY_MESSAGE) { if(!self) continue; - if(cmd["client_away_message"].string().length() > 256) + if(cmd["client_away_message"].string().length() > ts::kMaxAfkMessageLength) return command_result{error::parameter_invalid}; } else if(!self) { /* dont edit random properties of other clients. For us self its allowed to edit the rest without permissions */ continue; + } else if(info == property::CLIENT_TALK_REQUEST_MSG) { + if(cmd["client_talk_request_msg"].string().length() > ts::kMaxRequestTalkPowerMessageLength) + return command_result{error::parameter_invalid}; } keys.emplace_back(&info, key); diff --git a/shared b/shared index 1433225..1c64822 160000 --- a/shared +++ b/shared @@ -1 +1 @@ -Subproject commit 143322575d0f6e13d9eff7912bf8ce8c34020838 +Subproject commit 1c6482262f183f99dae9f230d5fcfe632f85fe4a