summaryrefslogtreecommitdiffstats
path: root/sesman/chansrv/chansrv.c
diff options
context:
space:
mode:
authorLukas Vacek <lucas.vacek@gmail.com>2013-06-22 21:57:16 +0100
committerLukas Vacek <lucas.vacek@gmail.com>2013-06-22 21:57:16 +0100
commite7fe39a65b732a2dcfeabce1d68edcb63b9a1c32 (patch)
tree51aba5e009b2fd1ffb59e8a51da0ffaa0d9bd11a /sesman/chansrv/chansrv.c
parenta0f8afca500702408f577a3b64f792700d40c01e (diff)
downloadxrdp-proprietary-e7fe39a65b732a2dcfeabce1d68edcb63b9a1c32.tar.gz
xrdp-proprietary-e7fe39a65b732a2dcfeabce1d68edcb63b9a1c32.zip
Fix sound and clipboard crashes
- In case clipboard is not initialized, clipboard_data_in returns (fixes a segfault) - If less than 4 bytes are sent to sound_send_wave_data_chunk, it returns (fixes a segfault) - When sending sound initiliazation messages set g_chan in chansrv to 0, so the server waits for client to reply (this makes sound work afte reconnecting) - In process_message_channel_setup, clear any leftover data in chan_items
Diffstat (limited to 'sesman/chansrv/chansrv.c')
-rw-r--r--sesman/chansrv/chansrv.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/sesman/chansrv/chansrv.c b/sesman/chansrv/chansrv.c
index 0f7ff042..a3b3f913 100644
--- a/sesman/chansrv/chansrv.c
+++ b/sesman/chansrv/chansrv.c
@@ -336,6 +336,23 @@ process_message_channel_setup(struct stream *s)
g_memset(ci->name, 0, sizeof(ci->name));
in_uint8a(s, ci->name, 8);
in_uint16_le(s, ci->id);
+ // there might be leftover data from last session after reconnecting
+ // so free it
+ if (ci->head != 0) {
+ struct chan_out_data* cod = ci->head;
+ struct chan_out_data* old_cod;
+ while (1) {
+ free_stream(cod->s);
+ old_cod = cod;
+ cod = cod->next;
+ g_free(old_cod);
+ if (ci->tail == old_cod) {
+ break;
+ }
+ }
+ }
+ ci->head = 0;
+ ci->tail = 0;
in_uint16_le(s, ci->flags);
LOGM((LOG_LEVEL_DEBUG, "process_message_channel_setup: chan name '%s' "
"id %d flags %8.8x", ci->name, ci->id, ci->flags));
@@ -386,6 +403,8 @@ process_message_channel_setup(struct stream *s)
if (g_rdpsnd_index >= 0)
{
+ // gets reset to 1 by next send_data_from_chan_item
+ g_sent = 0; // wait for response!
sound_init();
}