Re: [PATCH] session: do not set empty port value from uri

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

----- Original Message -----
> Setting an empty port value from URI makes spicy unable to connect from
> 'Recent connections' due a break URI given by spice_uri_create:
> 
> e.g: localhost?port=5900&tls-port=
> 
> Trying to connect with above URI breaks at spice_parse_uri with
> 'Failed to parse URI query'

I wonder if this shouldn't be acceptable URI, I think it could be.

> As we already check if port and tls_port are NULL, I've changed the
> check to verify if it is an empty string.

g_return_val_if_fail(s->port != NULL || s->tls_port != NULL, NULL);

We check if one of the two is !NULL, so you still need to keep a NULL check

> ---
>  gtk/spice-session.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/gtk/spice-session.c b/gtk/spice-session.c
> index 82ea55f..28ee8bc 100644
> --- a/gtk/spice-session.c
> +++ b/gtk/spice-session.c
> @@ -366,12 +366,13 @@ static gchar* spice_uri_create(SpiceSession *session)
>  
>          g_string_append(str, s->host);
>          g_string_append(str, "?");
> -        if (s->port != NULL) {
> +        if (s->port[0] != '\0') {
>              g_string_append_printf(str, "port=%s&", s->port);
>          }
> -        if (s->tls_port != NULL) {
> +        if (s->tls_port[0] != '\0') {
>              g_string_append_printf(str, "tls-port=%s", s->tls_port);
>          }
> +
>          return g_string_free(str, FALSE);
>      }
>  
> --
> 2.1.0
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]