diff --git a/src/protocols/rdp/channels/rdpsnd/rdpsnd.c b/src/protocols/rdp/channels/rdpsnd/rdpsnd.c index af1abcfa..3876f599 100644 --- a/src/protocols/rdp/channels/rdpsnd/rdpsnd.c +++ b/src/protocols/rdp/channels/rdpsnd/rdpsnd.c @@ -36,8 +36,10 @@ void guac_rdpsnd_process_receive(guac_rdp_common_svc* svc, guac_rdpsnd_pdu_header header; /* Check that we at least have a header. */ - if (Stream_GetRemainingLength(input_stream) < sizeof(header)) + if (Stream_GetRemainingLength(input_stream) < sizeof(header)) { + guac_client_log(svc->client, "Not enough bytes to process sound header."); return; + } /* Read RDPSND PDU header */ Stream_Read_UINT8(input_stream, header.message_type); @@ -45,8 +47,10 @@ void guac_rdpsnd_process_receive(guac_rdp_common_svc* svc, Stream_Read_UINT16(input_stream, header.body_size); /* Check that the body_size actually exists in the input stream. */ - if (Stream_GetRemainingLength(input_stream) < header.body_size) + if (Stream_GetRemainingLength(input_stream) < header.body_size) { + guac_client_log(svc->client, "Not enough bytes to process sound body."); return; + } /* * If next PDU is SNDWAVE (due to receiving WaveInfo PDU previously), diff --git a/src/protocols/rdp/plugins/guacai/guacai-messages.c b/src/protocols/rdp/plugins/guacai/guacai-messages.c index 8281780a..3f7b9d0b 100644 --- a/src/protocols/rdp/plugins/guacai/guacai-messages.c +++ b/src/protocols/rdp/plugins/guacai/guacai-messages.c @@ -267,8 +267,10 @@ void guac_rdp_ai_process_formats(guac_client* client, Stream_Seek_UINT32(stream); /* cbSizeFormatsPacket (MUST BE IGNORED) */ /* Check amount of data. */ - if (Stream_GetRemainingLength(stream) < (8 + num_formats)) + if (Stream_GetRemainingLength(stream) < (8 + num_formats)) { + guac_client_log(client, "Not enough bytes to process supported sound formats."); return; + } UINT32 index; for (index = 0; index < num_formats; index++) { diff --git a/src/protocols/rdp/plugins/guacai/guacai.c b/src/protocols/rdp/plugins/guacai/guacai.c index 18b4b439..8d7dc9c6 100644 --- a/src/protocols/rdp/plugins/guacai/guacai.c +++ b/src/protocols/rdp/plugins/guacai/guacai.c @@ -57,8 +57,10 @@ static void guac_rdp_ai_handle_data(guac_client* client, Stream_Read_UINT8(stream, message_id); /* If not enough data, bail out. */ - if (Stream_GetRemainingLength(stream) < 1) + if (Stream_GetRemainingLength(stream) < 1) { + guac_client_log(client, "Not enough data in stream for incoming audio."); return; + } /* Invoke appropriate message processor based on ID */ switch (message_id) {