From 47bf3ab6725f3ae90066c60420e5e1856218a3f2 Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Tue, 5 May 2020 17:15:47 -0400 Subject: [PATCH] GUACAMOLE-1059: Verify correct number of bytes for incoming wave. --- src/protocols/rdp/channels/rdpsnd/rdpsnd-messages.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/protocols/rdp/channels/rdpsnd/rdpsnd-messages.c b/src/protocols/rdp/channels/rdpsnd/rdpsnd-messages.c index be3a3772..e9eb6cc4 100644 --- a/src/protocols/rdp/channels/rdpsnd/rdpsnd-messages.c +++ b/src/protocols/rdp/channels/rdpsnd/rdpsnd-messages.c @@ -310,8 +310,8 @@ void guac_rdpsnd_wave_handler(guac_rdp_common_svc* svc, guac_rdp_client* rdp_client = (guac_rdp_client*) client->data; guac_audio_stream* audio = rdp_client->audio; - /* Verify we have at least 4 bytes, which is manually copied below. */ - if (Stream_Length(input_stream) < 4) { + /* Verify that the stream has bytes to cover the wave size plus header. */ + if (Stream_Length(input_stream) < (rdpsnd->incoming_wave_size + 4)) { guac_client_log(svc->client, GUAC_LOG_WARNING, "Audio Wave PDU does " "not contain the expected number of bytes. Sound may not work " "as expected.");