From 7acf438215d1b0e8e47a707f3585de8486a2e5fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Tue, 12 Jun 2012 20:46:56 +0200 Subject: git: Wrong parsing of ssh urls with IPv6 literals ignores port If we encounter an address part shaped like "[HOST]:PORT", we skip the opening bracket and replace the closing one with a NUL. The variable host then points to HOST and we've cut off the PORT part. Thus, when we go looking for it using host a bit later, we can't find it. Start at end instead, which either points to the colon, if present, or is equal to host. Signed-off-by: Rene Scharfe Reviewed-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- connect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'connect.c') diff --git a/connect.c b/connect.c index 912cddeea8..41b7400aa9 100644 --- a/connect.c +++ b/connect.c @@ -536,7 +536,7 @@ struct child_process *git_connect(int fd[2], const char *url_orig, * Add support for ssh port: ssh://host.xy:/... */ if (protocol == PROTO_SSH && host != url) - port = get_port(host); + port = get_port(end); if (protocol == PROTO_GIT) { /* These underlying connection commands die() if they -- cgit v1.2.3