[Spice-commits] src/spice-gtk-session.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jan 16 09:02:24 UTC 2019
src/spice-gtk-session.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
New commits:
commit ecf935870652506731842f033b1f7f203110a505
Author: Victor Toso <me at victortoso.com>
Date: Wed Jan 16 08:30:07 2019 +0100
gtk-session: clipboard: avoid possible index out of bounds
Should first check selection value before accessing those arrays.
The get_clipboard_from_selection() function does that for us.
Signed-off-by: Victor Toso <victortoso at redhat.com>
Acked-by: Marc-André Lureau <marcandre.lureau at redhat.com>
diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index 32f857d..1a19bca 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -1014,15 +1014,14 @@ static gboolean clipboard_request(SpiceMainChannel *main, guint selection,
GtkClipboard* cb;
int m;
+ cb = get_clipboard_from_selection(s, selection);
+ g_return_val_if_fail(cb != NULL, FALSE);
g_return_val_if_fail(s->clipboard_by_guest[selection] == FALSE, FALSE);
g_return_val_if_fail(s->clip_grabbed[selection], FALSE);
if (read_only(self))
return FALSE;
- cb = get_clipboard_from_selection(s, selection);
- g_return_val_if_fail(cb != NULL, FALSE);
-
if (type == VD_AGENT_CLIPBOARD_UTF8_TEXT) {
gtk_clipboard_request_text(cb, clipboard_received_text_cb,
get_weak_ref(self));
More information about the Spice-commits
mailing list