summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2014-08-12 16:17:16 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2014-08-13 17:21:34 +0200
commita8f2e2d9906f9908ab6cae0b9c36d99e5b49d05d (patch)
tree16320322bfefceb496c03077e15e5c30af2cc23c
parentd944678c52d121746884077379871104ee0ef6c7 (diff)
Ensure '\0' is not part of text clipboard data
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
-rw-r--r--gtk/spice-gtk-session.c9
1 files changed, 9 insertions, 0 deletions
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,