mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/PacketIO: Fixed handling CMSG_UPDATE_ACCOUNT_DATA - compressed value is not a null-terminated string
This commit is contained in:
@@ -706,19 +706,17 @@ void WorldSession::HandleUpdateAccountData(WorldPackets::ClientConfig::UserClien
|
||||
return;
|
||||
}
|
||||
|
||||
ByteBuffer dest(packet.Size, ByteBuffer::Resize{});
|
||||
std::string dest;
|
||||
dest.resize(packet.Size);
|
||||
|
||||
uLongf realSize = packet.Size;
|
||||
if (uncompress(dest.contents(), &realSize, packet.CompressedData.contents(), packet.CompressedData.size()) != Z_OK)
|
||||
if (uncompress(reinterpret_cast<Bytef*>(dest.data()), &realSize, packet.CompressedData.contents(), packet.CompressedData.size()) != Z_OK)
|
||||
{
|
||||
TC_LOG_ERROR("network", "UAD: Failed to decompress account data");
|
||||
return;
|
||||
}
|
||||
|
||||
std::string adata;
|
||||
dest >> adata;
|
||||
|
||||
SetAccountData(AccountDataType(packet.DataType), packet.Time, adata);
|
||||
SetAccountData(AccountDataType(packet.DataType), packet.Time, dest);
|
||||
}
|
||||
|
||||
void WorldSession::HandleRequestAccountData(WorldPackets::ClientConfig::RequestAccountData& request)
|
||||
|
||||
Reference in New Issue
Block a user