[Spice-devel] [PATCH spice-gtk 2/3] clipboard: pre-condition on selection value < 256
marcandre.lureau at redhat.com
marcandre.lureau at redhat.com
Fri Mar 22 14:20:13 UTC 2019
From: Marc-André Lureau <marcandre.lureau at redhat.com>
The protocol uses a u8 for the selection value. Make sure the given
argument value fits there, or throw a critical.
The other places seem to use u8 variables already.
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
src/channel-main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/channel-main.c b/src/channel-main.c
index 7d4b5c2..e359e8d 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -1354,6 +1354,7 @@ static void agent_clipboard_grab(SpiceMainChannel *channel, guint selection,
if (!c->agent_connected)
return;
+ g_return_if_fail(selection < 256);
g_return_if_fail(test_agent_cap(channel, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND));
size = sizeof(VDAgentClipboardGrab) + sizeof(uint32_t) * ntypes;
--
2.21.0.4.g36eb1cb9cf
More information about the Spice-devel
mailing list