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 <rene.scharfe@lsrfire.ath.cx> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Jun 12, 2012 at 20:46 UTC
7acf438215d1b0e8e47a707f3585de8486a2e5fe
1 file changed
+1
-1
connect.c
+1
-1
@@ -536,7 +536,7 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
536
* Add support for ssh port: ssh://host.xy:<port>/...
537
*/
538
if (protocol == PROTO_SSH && host != url)
539
- port = get_port(host);
539
+ port = get_port(end);
540
541
if (protocol == PROTO_GIT) {
542
/* These underlying connection commands die() if they