From 8560ff9718cc462fecf1b48ef556429869813bd7 Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Mon, 4 May 2020 12:11:37 -0400 Subject: [PATCH] GUACAMOLE-1059: Move rdpsnd body size check to correct location. --- src/protocols/rdp/channels/rdpsnd/rdpsnd.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/protocols/rdp/channels/rdpsnd/rdpsnd.c b/src/protocols/rdp/channels/rdpsnd/rdpsnd.c index 0873a946..522ddc49 100644 --- a/src/protocols/rdp/channels/rdpsnd/rdpsnd.c +++ b/src/protocols/rdp/channels/rdpsnd/rdpsnd.c @@ -44,14 +44,6 @@ void guac_rdpsnd_process_receive(guac_rdp_common_svc* svc, Stream_Seek_UINT8(input_stream); Stream_Read_UINT16(input_stream, header.body_size); - if (Stream_GetRemainingLength(input_stream) < header.body_size) { - guac_client_log(svc->client, GUAC_LOG_DEBUG, "Not enough bytes in stream." - " Remaining: %d, Body size: %d", - Stream_GetRemainingLength(input_stream), - header.body_size); - return; - } - /* * If next PDU is SNDWAVE (due to receiving WaveInfo PDU previously), * ignore the header and parse as a Wave PDU. @@ -60,6 +52,10 @@ void guac_rdpsnd_process_receive(guac_rdp_common_svc* svc, guac_rdpsnd_wave_handler(svc, input_stream, &header); return; } + + /* Check body size */ + if (Stream_GetRemainingLength(input_stream) < header.body_size) + return; /* Dispatch message to standard handlers */ switch (header.message_type) {