Deflate can cause a larger packet to be created overflowing the data stream
Fixes #75
This commit is contained in:
parent
1d00919196
commit
d7340614c4
1 changed files with 4 additions and 3 deletions
|
@ -572,15 +572,16 @@ int8 EQStream::EQ2_Compress(EQ2Packet* app, int8 offset){
|
|||
#endif
|
||||
|
||||
uchar* pDataPtr = app->pBuffer + offset;
|
||||
uchar* deflate_buff = new uchar[app->size];
|
||||
int xpandSize = app->size * 2;
|
||||
uchar* deflate_buff = new uchar[xpandSize];
|
||||
MCompressData.lock();
|
||||
stream.next_in = pDataPtr;
|
||||
stream.avail_in = app->size - offset;
|
||||
stream.next_out = deflate_buff;
|
||||
stream.avail_out = app->size;
|
||||
stream.avail_out = xpandSize;
|
||||
|
||||
deflate(&stream, Z_SYNC_FLUSH);
|
||||
int32 newsize = app->size - stream.avail_out;
|
||||
int32 newsize = xpandSize - stream.avail_out;
|
||||
safe_delete_array(app->pBuffer);
|
||||
app->size = newsize + offset;
|
||||
app->pBuffer = new uchar[app->size];
|
||||
|
|
Loading…
Add table
Reference in a new issue