This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/guacamole-server.git
commit c802cdce5627b4e0df77987878824cb167a1f9ba Merge: f076a54b d35ed8f7 Author: Virtually Nick <[email protected]> AuthorDate: Tue May 5 13:49:34 2026 -0400 Merge patch branch changes to main. Dockerfile | 2 +- src/common/common/defaults.h | 8 +- src/common/common/iconv.h | 24 ++ src/common/iconv.c | 514 +++++++++++++++++++++++++++-- src/common/tests/iconv/convert-test-data.c | 40 +++ src/common/tests/iconv/convert-test-data.h | 2 +- src/common/tests/iconv/convert.c | 124 ++++++- src/protocols/vnc/clipboard.c | 34 +- src/protocols/vnc/clipboard.h | 2 +- src/protocols/vnc/settings.c | 10 +- 10 files changed, 722 insertions(+), 38 deletions(-) diff --cc src/protocols/vnc/clipboard.c index 83334250,4af5b458..59674850 --- a/src/protocols/vnc/clipboard.c +++ b/src/protocols/vnc/clipboard.c @@@ -116,13 -110,7 +124,14 @@@ int guac_vnc_clipboard_blob_handler(gua int guac_vnc_clipboard_end_handler(guac_user* user, guac_stream* stream) { guac_vnc_client* vnc_client = (guac_vnc_client*) user->client->data; + + /* Ignore end of stream if no clipboard structure is available to handle + * the data that was received */ + guac_common_clipboard* clipboard = vnc_client->clipboard; + if (clipboard == NULL) + return 0; + + guac_client* client = user->client; rfbClient* rfb_client = vnc_client->rfb_client; /* Send via VNC only if finished connecting */ @@@ -154,10 -142,15 +163,16 @@@ } /* Fall back to classic clipboard with encoding conversion */ - char* output_data = guac_mem_alloc(GUAC_COMMON_CLIPBOARD_MAX_LENGTH); + int output_buf_size = clipboard->available; + char* output_data = guac_mem_alloc(output_buf_size); + if (output_data == NULL) { + guac_client_log(client, GUAC_LOG_WARNING, + "Clipboard conversion failed: unable to allocate output " + "buffer."); + return 1; + } - const char* input = vnc_client->clipboard->buffer; + const char* input = clipboard->buffer; char* output = output_data; guac_iconv_write* writer = vnc_client->clipboard_writer; @@@ -181,8 -173,13 +196,14 @@@ void guac_vnc_cut_text(rfbClient* clien if (vnc_client->settings->disable_copy) return; - char* received_data = guac_mem_alloc(GUAC_COMMON_CLIPBOARD_MAX_LENGTH); + int output_buf_size = vnc_client->clipboard->available; + char* received_data = guac_mem_alloc(output_buf_size); + if (received_data == NULL) { + guac_client_log(gc, GUAC_LOG_WARNING, + "Clipboard conversion failed: unable to allocate receive " + "buffer."); + return; + } const char* input = text; char* output = received_data;
