From 557e2f594445d7157d0e71da16c5d974f600059c Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Wed, 6 May 2020 10:17:20 -0400 Subject: [PATCH] GUACAMOLE-1059: Fine tune comments and log messages. --- src/protocols/rdp/channels/rdpdr/rdpdr-messages.c | 6 +++++- src/protocols/rdp/channels/rdpdr/rdpdr.c | 4 ++-- src/protocols/rdp/channels/rdpsnd/rdpsnd-messages.c | 5 ++++- src/protocols/rdp/channels/rdpsnd/rdpsnd.c | 2 +- src/protocols/rdp/plugins/guacai/guacai.c | 6 +++--- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/protocols/rdp/channels/rdpdr/rdpdr-messages.c b/src/protocols/rdp/channels/rdpdr/rdpdr-messages.c index c03d0b95..5fee4658 100644 --- a/src/protocols/rdp/channels/rdpdr/rdpdr-messages.c +++ b/src/protocols/rdp/channels/rdpdr/rdpdr-messages.c @@ -213,8 +213,12 @@ void guac_rdpdr_process_server_announce(guac_rdp_common_svc* svc, unsigned int major, minor, client_id; /* Stream should contain at least 8 bytes (UINT16 + UINT16 + UINT32) */ - if (Stream_GetRemainingLength(input_stream) < 8) + if (Stream_GetRemainingLength(input_stream) < 8) { + guac_client_log(svc->client, GUAC_LOG_WARNING, "Server Announce " + "Request PDU does not contain the expected number of bytes. " + "Device redirection may not work as expected."); return; + } Stream_Read_UINT16(input_stream, major); Stream_Read_UINT16(input_stream, minor); diff --git a/src/protocols/rdp/channels/rdpdr/rdpdr.c b/src/protocols/rdp/channels/rdpdr/rdpdr.c index d01abf42..68bb73e4 100644 --- a/src/protocols/rdp/channels/rdpdr/rdpdr.c +++ b/src/protocols/rdp/channels/rdpdr/rdpdr.c @@ -44,8 +44,8 @@ void guac_rdpdr_process_receive(guac_rdp_common_svc* svc, */ if (Stream_GetRemainingLength(input_stream) < 4) { guac_client_log(svc->client, GUAC_LOG_WARNING, "Device redirection " - "channel receive Stream does not contain the expected number " - "of bytes. Device redirection may not function as expected."); + "channel PDU header does not contain the expected number of " + "bytes. Device redirection may not function as expected."); return; } diff --git a/src/protocols/rdp/channels/rdpsnd/rdpsnd-messages.c b/src/protocols/rdp/channels/rdpsnd/rdpsnd-messages.c index e9eb6cc4..c057cd11 100644 --- a/src/protocols/rdp/channels/rdpsnd/rdpsnd-messages.c +++ b/src/protocols/rdp/channels/rdpsnd/rdpsnd-messages.c @@ -50,7 +50,10 @@ void guac_rdpsnd_formats_handler(guac_rdp_common_svc* svc, /* Reset own format count */ rdpsnd->format_count = 0; - /* Check to make sure the stream has at least 20 bytes, which */ + /* + * Check to make sure the stream has at least 20 bytes (14 byte seek, + * 2 x UTF16 reads, and 2 x UTF8 seeks). + */ if (Stream_GetRemainingLength(input_stream) < 20) { guac_client_log(client, GUAC_LOG_WARNING, "Server Audio Formats and " "Version PDU does not contain the expected number of bytes. " diff --git a/src/protocols/rdp/channels/rdpsnd/rdpsnd.c b/src/protocols/rdp/channels/rdpsnd/rdpsnd.c index 2950d1fd..40b53150 100644 --- a/src/protocols/rdp/channels/rdpsnd/rdpsnd.c +++ b/src/protocols/rdp/channels/rdpsnd/rdpsnd.c @@ -35,7 +35,7 @@ void guac_rdpsnd_process_receive(guac_rdp_common_svc* svc, guac_rdpsnd* rdpsnd = (guac_rdpsnd*) svc->data; guac_rdpsnd_pdu_header header; - /* Check that we at least the 4 byte header (UINT8 + UINT8 + UINT16) */ + /* Check that we have at least the 4 byte header (UINT8 + UINT8 + UINT16) */ if (Stream_GetRemainingLength(input_stream) < 4) { guac_client_log(svc->client, GUAC_LOG_WARNING, "Audio Stream does not " "contain the expected number of bytes. Audio redirection may " diff --git a/src/protocols/rdp/plugins/guacai/guacai.c b/src/protocols/rdp/plugins/guacai/guacai.c index 577c2eff..b5383c4f 100644 --- a/src/protocols/rdp/plugins/guacai/guacai.c +++ b/src/protocols/rdp/plugins/guacai/guacai.c @@ -54,9 +54,9 @@ static void guac_rdp_ai_handle_data(guac_client* client, /* Verify we have at least 1 byte in the stream (UINT8) */ if (Stream_GetRemainingLength(stream) < 1) { - guac_client_log(client, GUAC_LOG_WARNING, "Audio input stream does not " - "contain the expected number of bytes. Audio input redirection " - "may not work as expected."); + guac_client_log(client, GUAC_LOG_WARNING, "Audio input PDU header does " + "not contain the expected number of bytes. Audio input " + "redirection may not work as expected."); return; }