[spice-gtk] Ensure '\0' is not part of text clipboard data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Windows, with some versions of gtk+, GtkSelectionData::length
will include the final '\0'.
When a string with this trailing '\0' is pasted in some linux
applications, it will be pasted as <NIL> or as an invisible character,
which is unwanted.

This commit ensures the length we send to the agent does not
include any trailing '\0'.

https://bugzilla.redhat.com/show_bug.cgi?id=1090122
---
 gtk/spice-gtk-session.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gtk/spice-gtk-session.c b/gtk/spice-gtk-session.c
index db5c53c..84a83a2 100644
--- a/gtk/spice-gtk-session.c
+++ b/gtk/spice-gtk-session.c
@@ -890,6 +890,15 @@ static void clipboard_received_cb(GtkClipboard *clipboard,
         }
 
         len = strlen(conv);
+    } else {
+        /* On Windows, with some versions of gtk+, GtkSelectionData::length
+         * will include the final '\0'. When a string with this trailing '\0'
+         * is pasted in some linux applications, it will be pasted as <NIL> or
+         * as an invisible character, which is unwanted. Ensure the length we
+         * send to the agent does not include any trailing '\0'
+         * This is gtk+ bug https://bugzilla.gnome.org/show_bug.cgi?id=734670
+         */
+        len = strlen((const char *)data);
     }
 
     spice_main_clipboard_selection_notify(s->main, selection, type,
-- 
1.9.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]