Blob Blame History Raw
From 6be22cda720b42feb7760ebddb68e4cee96f259a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@gmail.com>
Date: Mon, 18 Nov 2013 11:28:25 +0100
Subject: [PATCH] reds: lookup corresponding channel id

In reds_send_link_ack(), lookup the channel with the same id as the link
message.

The bug was found during code review a while ago.

A reproducer bug was later reported:
https://bugzilla.redhat.com/show_bug.cgi?id=1058625

(cherry picked from commit a434543eb1243db1e52ca6a4e0cdfb425c277e56)
---
 server/reds.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/server/reds.c b/server/reds.c
index 7b7f262..464552a 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -1459,7 +1459,8 @@ static int reds_send_link_ack(RedLinkInfo *link)
 
     ack.error = SPICE_LINK_ERR_OK;
 
-    channel = reds_find_channel(link->link_mess->channel_type, 0);
+    channel = reds_find_channel(link->link_mess->channel_type,
+                                link->link_mess->channel_id);
     if (!channel) {
         spice_assert(link->link_mess->channel_type == SPICE_CHANNEL_MAIN);
         spice_assert(reds->main_channel);