Skip to content
Snippets Groups Projects
Commit d46ddd21 authored by Marc-André Lureau's avatar Marc-André Lureau
Browse files

clipboard: pre-condition on selection value <= 255


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: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
parent a723bf67
No related branches found
No related tags found
No related merge requests found
...@@ -1354,6 +1354,7 @@ static void agent_clipboard_grab(SpiceMainChannel *channel, guint selection, ...@@ -1354,6 +1354,7 @@ static void agent_clipboard_grab(SpiceMainChannel *channel, guint selection,
if (!c->agent_connected) if (!c->agent_connected)
return; return;
g_return_if_fail(selection <= G_MAXUINT8);
g_return_if_fail(test_agent_cap(channel, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND)); g_return_if_fail(test_agent_cap(channel, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND));
size = sizeof(VDAgentClipboardGrab) + sizeof(uint32_t) * ntypes; size = sizeof(VDAgentClipboardGrab) + sizeof(uint32_t) * ntypes;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment