libfreerdp-core: fix handling of uncompressed packets

This commit is contained in:
Marc-André Moreau 2014-03-26 09:16:28 -04:00
parent cc3719efa7
commit 797d326252
2 changed files with 13 additions and 7 deletions

View File

@ -77,7 +77,7 @@ int bulk_decompress(rdpBulk* bulk, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstD
{
*ppDstData = pSrcData;
*pDstSize = SrcSize;
status = 1;
status = 0;
}
if (status >= 0)

View File

@ -337,6 +337,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s)
rdpRdp* rdp;
int next_pos;
wStream* cs;
int bulkStatus;
UINT32 totalSize;
BYTE updateCode;
BYTE fragmentation;
@ -365,8 +366,18 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s)
cs = s;
next_pos = Stream_GetPosition(s) + size;
if (bulk_decompress(rdp->bulk, Stream_Pointer(s), size, &pDstData, &DstSize, compressionFlags))
bulkStatus = bulk_decompress(rdp->bulk, Stream_Pointer(s), size, &pDstData, &DstSize, compressionFlags);
if (bulkStatus < 0)
{
fprintf(stderr, "bulk_decompress() failed\n");
return -1;
}
if (bulkStatus > 0)
{
/* data was compressed, copy from decompression buffer */
size = DstSize;
cs = StreamPool_Take(transport->ReceivePool, DstSize);
@ -375,11 +386,6 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s)
Stream_SealLength(cs);
Stream_SetPosition(cs, 0);
}
else
{
fprintf(stderr, "bulk_decompress() failed\n");
Stream_Seek(s, size);
}
if (fragmentation == FASTPATH_FRAGMENT_SINGLE)
{