etrunko / rpms / spice-gtk

Forked from rpms/spice-gtk 4 years ago
Clone

Blame 0005-clipboard-pre-condition-on-selection-value-256.patch

56f7953
From 7bbf04e5484129037d29018352ab6d3333fddf05 Mon Sep 17 00:00:00 2001
56f7953
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
56f7953
Date: Fri, 22 Mar 2019 15:20:13 +0100
56f7953
Subject: [PATCH 5/6] clipboard: pre-condition on selection value < 256
56f7953
MIME-Version: 1.0
56f7953
Content-Type: text/plain; charset=UTF-8
56f7953
Content-Transfer-Encoding: 8bit
56f7953
56f7953
The protocol uses a u8 for the selection value. Make sure the given
56f7953
argument value fits there, or throw a critical.
56f7953
56f7953
The other places seem to use u8 variables already.
56f7953
56f7953
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
56f7953
---
56f7953
 src/channel-main.c | 1 +
56f7953
 1 file changed, 1 insertion(+)
56f7953
56f7953
diff --git a/src/channel-main.c b/src/channel-main.c
56f7953
index adf6bab..8574ae6 100644
56f7953
--- a/src/channel-main.c
56f7953
+++ b/src/channel-main.c
56f7953
@@ -1354,6 +1354,7 @@ static void agent_clipboard_grab(SpiceMainChannel *channel, guint selection,
56f7953
     if (!c->agent_connected)
56f7953
         return;
56f7953
 
56f7953
+    g_return_if_fail(selection < 256);
56f7953
     g_return_if_fail(test_agent_cap(channel, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND));
56f7953
 
56f7953
     size = sizeof(VDAgentClipboardGrab) + sizeof(uint32_t) * ntypes;
56f7953
-- 
56f7953
2.23.0
56f7953