On Thu, 2016-09-01 at 16:05 +0200, Christophe Fergeau wrote: > 5c8f400 "clipboard: Add clipboard_atom_to_vdagent_type helper" > mistakenly removed some early returns when text conversion fails for > some reason. This commit readds it. > --- > Maybe this... Not really convinced. An alternative would be to g_strdup(text) > when we don't convert, but that's a fairly useless string duplication. or (due to recent change): 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, > > Christophe > > src/spice-gtk-session.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c > index 5766bbd..d29bf92 100644 > --- a/src/spice-gtk-session.c > +++ b/src/spice-gtk-session.c > @@ -967,7 +967,6 @@ static char *fixup_clipboard_text(SpiceGtkSession *self, > const char *text, int * > char *conv = NULL; > int new_len = *len; > > - > if (spice_main_agent_test_capability(self->priv->main, > VD_AGENT_CAP_GUEST_LINEEND_CRLF)) { > GError *err = NULL; > > @@ -975,6 +974,7 @@ static char *fixup_clipboard_text(SpiceGtkSession *self, > const char *text, int * > if (err) { > g_warning("Failed to convert text line ending: %s", err- > >message); > g_clear_error(&err); > + *len = -1; > return NULL; > } > > @@ -992,6 +992,7 @@ static char *fixup_clipboard_text(SpiceGtkSession *self, > const char *text, int * > > if (!check_clipboard_size_limits(self, new_len)) { > g_free(conv); > + *len = -1; > return NULL; > } > > @@ -1026,6 +1027,9 @@ 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 (len == -1) { > + return; > + } > > spice_main_clipboard_selection_notify(self->priv->main, selection, > VD_AGENT_CLIPBOARD_UTF8_TEXT, > _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel