[Spice-commits] src/spice-gtk-session.c

Pavel Grunt pgrunt at kemper.freedesktop.org
Fri Sep 2 12:47:49 UTC 2016


 src/spice-gtk-session.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 24fe1387f966193c60d5f2c72a0f551b7ed593f1
Author: Pavel Grunt <pgrunt at redhat.com>
Date:   Fri Sep 2 14:03:26 2016 +0200

    clipboard: Return early if check_clipboard_size_limits() fails
    
    b0a2ff4 "clipboard: Add fixup_clipboard_text helper"
    mistakenly removed some early returns when text conversion fails for
    some reason. This commit readds it.
    
    Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
    Signed-off-by: Pavel Grunt <pgrunt at redhat.com>

diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index 0d0193e..3ff4e9a 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -926,11 +926,6 @@ static char *fixup_clipboard_text(SpiceGtkSession *self, const char *text, int *
         new_len = strlen(text);
     }
 
-    if (!check_clipboard_size_limits(self, new_len)) {
-        g_free(conv);
-        return NULL;
-    }
-
     *len = new_len;
     return conv;
 }
@@ -962,6 +957,10 @@ static void clipboard_received_text_cb(GtkClipboard *clipboard,
 
     /* gtk+ internal utf8 newline is always LF, even on windows */
     conv = fixup_clipboard_text(self, text, &len);
+    if (!check_clipboard_size_limits(self, len)) {
+        g_free(conv);
+        return;
+    }
 
     spice_main_clipboard_selection_notify(self->priv->main, selection,
                                           VD_AGENT_CLIPBOARD_UTF8_TEXT,


More information about the Spice-commits mailing list