aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/interface-gtk/interface.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/interface-gtk/interface.c b/src/interface-gtk/interface.c
index 843ad15..8cf0aab 100644
--- a/src/interface-gtk/interface.c
+++ b/src/interface-gtk/interface.c
@@ -717,6 +717,11 @@ teco_interface_get_clipboard(const gchar *name, gchar **str, gsize *len, GError
}
*len = gtk_selection_data_get_length(contents);
+#ifdef G_OS_WIN32
+ /* the length always contains a trailing null byte on Windows */
+ if (*len > 0)
+ (*len)--;
+#endif
if (str) {
/* gtk_selection_data_get_text() does not work with embedded nulls */
*str = memcpy(g_malloc(*len+1), gtk_selection_data_get_data(contents), *len);