Fixed some crashes (1.4.12b4)

This commit is contained in:
WolverinDEV
2020-04-15 15:02:59 +02:00
parent 0f1665c97d
commit bb935dd214
6 changed files with 16 additions and 5 deletions
@@ -369,6 +369,13 @@ bool VoiceClientConnection::next_reassembled_command(unique_lock<std::recursive_
std::string error{};
auto decompressed_size = compression::qlz_decompressed_size(payload.data_ptr(), payload.length());
if(decompressed_size == 0) {
logTrace(this->client->getServerId(), "{} Failed to calculate decompressed size for received command. Dropping packet.", CLIENT_STR_LOG_PREFIX_(this->client));
return false;
} else if(decompressed_size > 20 * 1024 * 1024) { /* max 20MB */
logTrace(this->client->getServerId(), "{} Command packet has a too large compressed size. Dropping packet.", CLIENT_STR_LOG_PREFIX_(this->client));
return false;
}
auto buffer = buffer::allocate_buffer(decompressed_size);
if(!compression::qlz_decompress_payload(payload.data_ptr(), buffer.data_ptr(), &decompressed_size)) {
logTrace(this->client->getServerId(), "{} Failed to decompress received command. Dropping packet.", CLIENT_STR_LOG_PREFIX_(this->client));