diff --git a/libfreerdp/core/bulk.c b/libfreerdp/core/bulk.c index 1b1273800..4956b007c 100644 --- a/libfreerdp/core/bulk.c +++ b/libfreerdp/core/bulk.c @@ -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) diff --git a/libfreerdp/core/fastpath.c b/libfreerdp/core/fastpath.c index ba9af739a..9d5157567 100644 --- a/libfreerdp/core/fastpath.c +++ b/libfreerdp/core/fastpath.c @@ -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) {