Fixed some too long messages
This commit is contained in:
parent
3f700e79d3
commit
1e0c9eabe3
@ -1 +1 @@
|
||||
Subproject commit e6087512662f5bed71a47b45b1824fc78d27aeda
|
||||
Subproject commit d75ecb67041c3b9958d75848c253e35774d36578
|
@ -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<property::ClientProperties>(key);
|
||||
|
@ -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<command_result_bulk>(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);
|
||||
|
2
shared
2
shared
@ -1 +1 @@
|
||||
Subproject commit 143322575d0f6e13d9eff7912bf8ce8c34020838
|
||||
Subproject commit 1c6482262f183f99dae9f230d5fcfe632f85fe4a
|
Loading…
Reference in New Issue
Block a user