summaryrefslogtreecommitdiff
path: root/client/gvfsuriutils.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@gnome.org>2008-03-02 18:12:07 +0000
committerBenjamin Otte <otte@src.gnome.org>2008-03-02 18:12:07 +0000
commitfd6d662be4e608cbffd92c8aece39d54d72de1f1 (patch)
tree76f085d9b2cd265f8afb13e8be824b8305f588f1 /client/gvfsuriutils.c
parentf461a701ed6bf04e32bc40b7262ea691ede7ce19 (diff)
downloadgvfs-fd6d662be4e608cbffd92c8aece39d54d72de1f1.tar.gz
don't pass the [] when parsing IPv6 addresses
2008-03-02 Benjamin Otte <otte@gnome.org> * client/gvfsuriutils.c: (g_vfs_decode_uri): don't pass the [] when parsing IPv6 addresses svn path=/trunk/; revision=1484
Diffstat (limited to 'client/gvfsuriutils.c')
-rw-r--r--client/gvfsuriutils.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/client/gvfsuriutils.c b/client/gvfsuriutils.c
index 428f1ef2..f281ba89 100644
--- a/client/gvfsuriutils.c
+++ b/client/gvfsuriutils.c
@@ -181,23 +181,25 @@ g_vfs_decode_uri (const char *uri)
return NULL;
}
port_start = memchr (host_end, ':', authority_end - host_start);
+ host_start++;
}
else
{
port_start = memchr (host_start, ':', authority_end - host_start);
+ host_end = port_start ? port_start : authority_end;
}
if (port_start)
{
- host_end = port_start++;
-
- decoded->port = atoi(port_start);
+ decoded->port = atoi(port_start + 1);
+ if (decoded->port <= 0)
+ {
+ g_vfs_decoded_uri_free (decoded);
+ return NULL;
+ }
}
else
- {
- host_end = authority_end;
- decoded->port = -1;
- }
+ decoded->port = -1;
decoded->host = g_strndup (host_start, host_end - host_start);