From 825d63cf0cce651e3c2a277f135ff4a6c417072f Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Wed, 4 Mar 2020 14:59:27 +0100 Subject: [PATCH] Added clarifications in freerdp_channel_process --- libfreerdp/core/channels.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libfreerdp/core/channels.c b/libfreerdp/core/channels.c index a62307abf..6cff02efb 100644 --- a/libfreerdp/core/channels.c +++ b/libfreerdp/core/channels.c @@ -139,6 +139,11 @@ BOOL freerdp_channel_process(freerdp* instance, wStream* s, UINT16 channelId, si if (Stream_GetRemainingLength(s) < 8) return FALSE; + /* [MS-RDPBCGR] 3.1.5.2.2 Processing of Virtual Channel PDU + * chunked data. Length is the total size of the combined data, + * chunkLength is the actual data received. + * check chunkLength against packetLength, which is the TPKT header size. + */ Stream_Read_UINT32(s, length); Stream_Read_UINT32(s, flags); chunkLength = Stream_GetRemainingLength(s); @@ -150,7 +155,7 @@ BOOL freerdp_channel_process(freerdp* instance, wStream* s, UINT16 channelId, si } if (length < chunkLength) { - WLog_ERR(TAG, "Expected %" PRIu32 " bytes, but only have %" PRIdz, length, chunkLength); + WLog_ERR(TAG, "Expected %" PRIu32 " bytes, but have %" PRIdz, length, chunkLength); return FALSE; } IFCALLRET(instance->ReceiveChannelData, rc, instance, channelId, Stream_Pointer(s), chunkLength, @@ -209,7 +214,7 @@ BOOL freerdp_channel_peer_process(freerdp_peer* client, wStream* s, UINT16 chann else if (client->ReceiveChannelData) { int rc = client->ReceiveChannelData(client, channelId, Stream_Pointer(s), chunkLength, - flags, length); + flags, length); if (rc < 0) return FALSE; }