Github user necouchman commented on a diff in the pull request: https://github.com/apache/guacamole-server/pull/154#discussion_r199625398 --- Diff: src/protocols/rdp/guac_rdpdr/rdpdr_messages.c --- @@ -122,20 +124,28 @@ static void guac_rdpdr_send_client_capability(guac_rdpdrPlugin* rdpdr) { static void guac_rdpdr_send_client_device_list_announce_request(guac_rdpdrPlugin* rdpdr) { - int i; - wStream* output_stream = Stream_New(NULL, 256); + /* Calculate number of bytes needed for the stream */ + int streamBytes = 16; + for (int i=0; i < rdpdr->devices_registered; i++) + streamBytes += rdpdr->devices[i].device_announce_len; + + /* Allocate the stream */ + wStream* output_stream = Stream_New(NULL, streamBytes); /* Write header */ Stream_Write_UINT16(output_stream, RDPDR_CTYP_CORE); Stream_Write_UINT16(output_stream, PAKID_CORE_DEVICELIST_ANNOUNCE); - /* List devices */ + /* Get the stream for each of the devices. */ Stream_Write_UINT32(output_stream, rdpdr->devices_registered); - for (i=0; i<rdpdr->devices_registered; i++) { - guac_rdpdr_device* device = &(rdpdr->devices[i]); - device->announce_handler(device, output_stream, i); + for (int i=0; i<rdpdr->devices_registered; i++) { + + Stream_Copy(output_stream, rdpdr->devices[i].device_announce, --- End diff -- I'll take a look - I might need some guidance figuring this out, but I'll give it a try.
---