connect: reject ssh hostname that begins with a dash
[gitweb.git] / connect.c
index fd7ffe1840e64417cf94d208840cf97c91e962b7..0e8e05d83af705a72495a06f544394f67547da2d 100644 (file)
--- a/connect.c
+++ b/connect.c
@@ -754,6 +754,9 @@ struct child_process *git_connect(int fd[2], const char *url,
                                return NULL;
                        }
 
+                       if (ssh_host[0] == '-')
+                               die("strange hostname '%s' blocked", ssh_host);
+
                        ssh = getenv("GIT_SSH_COMMAND");
                        if (!ssh) {
                                const char *base;