Github user mike-jumper commented on a diff in the pull request:
https://github.com/apache/guacamole-server/pull/154#discussion_r199684958
--- 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 --
aHA! You're missing the `Stream_New()` and corresponding assignment to
`device->device_announce` for the printer device. It's there for filesystem,
but not for printer:
https://github.com/apache/guacamole-server/blob/e2994778c3fed6e71f809aa589afe2db32b2e0ae/src/protocols/rdp/guac_rdpdr/rdpdr_fs_service.c#L144
---