[8231] Use more safe destination buffer size for zlib compression. Author: SilverIce

[8230] Add new line at the end of file Player.h to make gcc happy. Author: Gendalph

--HG--
branch : trunk
This commit is contained in:
megamage
2009-07-30 10:39:53 +08:00
parent 5d9d64e6f0
commit b2b3983e89
3 changed files with 6 additions and 5 deletions
+4 -3
View File
@@ -1018,10 +1018,11 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recv_data)
uint32 size = adata->Data.size();
ByteBuffer dest;
dest.resize(size);
uLongf destSize = compressBound(size);
ByteBuffer dest;
dest.resize(destSize);
uLongf destSize = size;
if(size && compress(const_cast<uint8*>(dest.contents()), &destSize, (uint8*)adata->Data.c_str(), size) != Z_OK)
{
sLog.outDebug("RAD: Failed to compress account data");
+1 -1
View File
@@ -2462,4 +2462,4 @@ template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas
basevalue = T((float)basevalue + diff);
return T(diff);
}
#endif
#endif
+1 -1
View File
@@ -128,7 +128,7 @@ bool UpdateData::BuildPacket(WorldPacket *packet)
if (pSize > 100 ) // compress large packets
{
uint32 destsize = pSize;
uint32 destsize = compressBound(pSize);
packet->resize( destsize + sizeof(uint32) );
packet->put<uint32>(0, pSize);