[Spice-devel] [PATCH] spice-channel: warn and fail if pubkey is NULL (instead of crashing in next line)

Marc-André Lureau marcandre.lureau at gmail.com
Thu Mar 17 07:32:44 PDT 2011


On Thu, Mar 17, 2011 at 12:10 PM, Alon Levy <alevy at redhat.com> wrote:
> ---
>  gtk/spice-channel.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
> index 539bc39..e701f31 100644
> --- a/gtk/spice-channel.c
> +++ b/gtk/spice-channel.c
> @@ -822,6 +822,7 @@ static void spice_channel_send_spice_ticket(SpiceChannel *channel)
>
>     BIO_write(bioKey, c->peer_msg->pub_key, SPICE_TICKET_PUBKEY_BYTES);
>     pubkey = d2i_PUBKEY_bio(bioKey, NULL);
> +    g_warn_if_fail(pubkey == NULL);

You probably meant:
g_warn_if_fail(pubkey != NULL);

Also, perhaps we can just do
g_return_if_fail(pubkey != NULL);

To avoid crashing right after. Ok with that?

>     rsa = pubkey->pkey.rsa;
>     nRSASize = RSA_size(rsa);
>
> --
> 1.7.4.1
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>



-- 
Marc-André Lureau


More information about the Spice-devel mailing list