[Spice-devel] [spice-gtk v1] gtk-session: reply agent's clipboard request on failure
Victor Toso
victortoso at redhat.com
Fri Feb 24 11:50:49 UTC 2017
Hi,
On Fri, Feb 24, 2017 at 12:36:56PM +0100, Pavel Grunt wrote:
> On Fri, 2017-02-24 at 11:26 +0100, Victor Toso wrote:
> > > > > > > conv = fixup_clipboard_text(self, text, &len);
> > > > > > > if (!check_clipboard_size_limits(self, len)) {
> > > > > > > - g_free(conv);
> > > > > > > - return;
> > > > > > > + SPICE_DEBUG("Failed sized limits of clipboard
> > > > > > > text
> > > > > > > (%d
> > > > > > > bytes)", len);
> > > > > > > + g_clear_pointer(&conv, g_free);
> > > > >
> > > > > thanks to goto there is no need to clear it
> > > >
> > > > We do. Conv might not have failed, this check checks the
> > > > clipboard_size_limits so, if limit exceed the protocol limit, we
> > > > need to
> > > > free conv here to send the right value to agent (nothing).
> > >
> > > it sends len = 0
> >
> > But I don't think it is right to put a valid buffer and 0 as len.
>
> "text" is also nonnull - no difference to me
I missed it. Still, no good :(
The chain up calls will be:
1-) spice_main_clipboard_selection_notify() (with data != NULL)
2-) agent_clipboard_notify()
3-) agent_msg_queue_many()
-> and here we do:
980 va_start(args, data);
981 for (d = data; d != NULL; d = va_arg(args, void*)) {
982 size += va_arg(args, gsize);
983 }
984 va_end(args);
-> which changes the size of the message if data is nonnull.
I'll fix it. Nice catch!!!
toso
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170224/5c3fcd0a/attachment-0001.sig>
More information about the Spice-devel
mailing list