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

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

 



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'

As we already check if port and tls_port are NULL, I've changed the
check to verify if it is an empty string.
---
 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





[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]