From e4f476fce4e4dc08141df50e8d2ce549570826e7 Mon Sep 17 00:00:00 2001 From: Martin Fleisz Date: Thu, 29 Sep 2022 12:00:27 +0000 Subject: [PATCH] proxy: Fix handling of in drdynvc DATA_FIRST_PDU in proxy During tests I sometimes received DATA_FIRST_PDUs that were not part of a fragmented message but contained a complete PDU. The documentation is not quite clear about if this is a possible scenario or a protocol violation. However in the description of the Data field it says: If the sum of the DVC header size and the value specified by the Length field is less than 1600 bytes, then the actual data length equals the value specified by the Length field. This hints that DATA_FIRST_PDU might also contain complete Data and does not necessarily mean to be the first part of a fragmented PDU. --- server/proxy/channels/pf_channel_drdynvc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/server/proxy/channels/pf_channel_drdynvc.c b/server/proxy/channels/pf_channel_drdynvc.c index 47b647a5a..a2acf3f64 100644 --- a/server/proxy/channels/pf_channel_drdynvc.c +++ b/server/proxy/channels/pf_channel_drdynvc.c @@ -406,13 +406,6 @@ static PfChannelResult DynvcTrackerPeekFn(ChannelStateTracker* tracker, BOOL fir trackerState->CurrentDataReceived, trackerState->currentDataLength); return PF_CHANNEL_RESULT_ERROR; } - - if (trackerState->CurrentDataReceived == trackerState->currentDataLength) - { - trackerState->currentDataLength = 0; - trackerState->CurrentDataFragments = 0; - trackerState->CurrentDataReceived = 0; - } } else { @@ -421,6 +414,13 @@ static PfChannelResult DynvcTrackerPeekFn(ChannelStateTracker* tracker, BOOL fir } } + if (trackerState->CurrentDataReceived == trackerState->currentDataLength) + { + trackerState->currentDataLength = 0; + trackerState->CurrentDataFragments = 0; + trackerState->CurrentDataReceived = 0; + } + switch (dynChannel->channelMode) { case PF_UTILS_CHANNEL_PASSTHROUGH: