From: Armin Novak Date: Fri, 9 Aug 2013 14:23:00 +0000 (+0200) Subject: Fixed invalid package size allocation and calculation in cliprdr_process_format_list_... X-Git-Tag: 1.2.0-beta1+android7~209^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a57f1302f4a3e1c7fe1c16882844755d349b109c;p=platform%2Fupstream%2Ffreerdp.git Fixed invalid package size allocation and calculation in cliprdr_process_format_list_event Enabled and fixed error handling in cliprdr_process_format_list_response --- diff --git a/channels/cliprdr/client/cliprdr_format.c b/channels/cliprdr/client/cliprdr_format.c index 023bbf8..fb6bef9 100644 --- a/channels/cliprdr/client/cliprdr_format.c +++ b/channels/cliprdr/client/cliprdr_format.c @@ -87,14 +87,15 @@ void cliprdr_process_format_list_event(cliprdrPlugin* cliprdr, RDP_CB_FORMAT_LIS if (!cliprdr->use_long_format_names) name_length = 32; - Stream_EnsureRemainingCapacity(body, Stream_Capacity(body) + 4 + name_length); + Stream_EnsureRemainingCapacity(body, 4 + name_length); Stream_Write_UINT32(body, cb_event->formats[i]); Stream_Write(body, name, name_length); } - s = cliprdr_packet_new(CB_FORMAT_LIST, 0, Stream_Capacity(body)); - Stream_Write(s, Stream_Buffer(body), Stream_Capacity(body)); + Stream_SealLength(body); + s = cliprdr_packet_new(CB_FORMAT_LIST, 0, Stream_Length(body)); + Stream_Write(s, Stream_Buffer(body), Stream_Length(body)); Stream_Free(body, TRUE); } @@ -291,15 +292,15 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, wStream* s, UINT32 data void cliprdr_process_format_list_response(cliprdrPlugin* cliprdr, wStream* s, UINT32 dataLen, UINT16 msgFlags) { /* where is this documented? */ -#if 0 wMessage* event; if ((msgFlags & CB_RESPONSE_FAIL) != 0) { - event = freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR, RDP_EVENT_TYPE_CB_MONITOR_READY, NULL, NULL); + /* In case of an error the clipboard will cease to operate. + * Post this event to reenable the plugin. */ + event = freerdp_event_new(CliprdrChannel_Class, CliprdrChannel_MonitorReady, NULL, NULL); svc_plugin_send_event((rdpSvcPlugin*) cliprdr, event); } -#endif } void cliprdr_process_format_data_request(cliprdrPlugin* cliprdr, wStream* s, UINT32 dataLen, UINT16 msgFlags)