[Spice-devel] [PATCH spice-gtk 2/3] clipboard: pre-condition on selection value < 256

Victor Toso victortoso at redhat.com
Wed Apr 3 09:13:00 UTC 2019


Hi,

On Fri, Mar 22, 2019 at 03:20:13PM +0100, marcandre.lureau at redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau at redhat.com>
> 
> The protocol uses a u8 for the selection value. Make sure the given
> argument value fits there, or throw a critical.
> 
> The other places seem to use u8 variables already.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
> ---
>  src/channel-main.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/channel-main.c b/src/channel-main.c
> index 7d4b5c2..e359e8d 100644
> --- a/src/channel-main.c
> +++ b/src/channel-main.c
> @@ -1354,6 +1354,7 @@ static void agent_clipboard_grab(SpiceMainChannel *channel, guint selection,

This reminds me that this should be a bool. We don't need to
spice_channel_wakeup() if we fail anywhere here, I think.

>      if (!c->agent_connected)
>          return;
>  
> +    g_return_if_fail(selection < 256);

or <= G_MAXUINT8, either way

Acked-by: Victor Toso <victortoso at redhat.com>

Still have to follow up the discussion on the new messages but
this one could be pushed anyway...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20190403/0d31f772/attachment.sig>


More information about the Spice-devel mailing list