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
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel