From a0de1b18bdd7ddc606320d34af83bd0111e06978 Mon Sep 17 00:00:00 2001 From: Martin Fleisz Date: Wed, 6 Mar 2013 13:33:09 +0100 Subject: [PATCH] core: Correct handling of MultifragMaxRequestSize (Fixes #1022) --- libfreerdp/core/capabilities.c | 5 ++++- libfreerdp/core/fastpath.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libfreerdp/core/capabilities.c b/libfreerdp/core/capabilities.c index 5cec55fbd..da67ef59b 100644 --- a/libfreerdp/core/capabilities.c +++ b/libfreerdp/core/capabilities.c @@ -2190,10 +2190,13 @@ BOOL rdp_print_desktop_composition_capability_set(STREAM* s, UINT16 length) BOOL rdp_read_multifragment_update_capability_set(STREAM* s, UINT16 length, rdpSettings* settings) { + UINT32 multifragMaxRequestSize; if (length < 8) return FALSE; - stream_read_UINT32(s, settings->MultifragMaxRequestSize); /* MaxRequestSize (4 bytes) */ + stream_read_UINT32(s, multifragMaxRequestSize); /* MaxRequestSize (4 bytes) */ + if (settings->MultifragMaxRequestSize < multifragMaxRequestSize) + settings->MultifragMaxRequestSize = multifragMaxRequestSize; return TRUE; } diff --git a/libfreerdp/core/fastpath.c b/libfreerdp/core/fastpath.c index f2e67a96b..e37fed785 100644 --- a/libfreerdp/core/fastpath.c +++ b/libfreerdp/core/fastpath.c @@ -340,7 +340,7 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, STREAM* s) stream_check_size(fastpath->updateData, size); stream_copy(fastpath->updateData, comp_stream, size); - if (stream_get_size(fastpath->updateData) > rdp->settings->MultifragMaxRequestSize) + if (stream_get_length(fastpath->updateData) > rdp->settings->MultifragMaxRequestSize) { printf("fastpath PDU is bigger than MultifragMaxRequestSize\n"); return -1;