aboutsummaryrefslogtreecommitdiff
path: root/connect.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-07-28 16:11:54 -0700
committerJunio C Hamano <gitster@pobox.com>2017-07-28 16:11:54 -0700
commita4f234bf9bd3fb11fb1608a507783d9412af27a9 (patch)
tree844124df0896caa172359b472bf436c8d13be969 /connect.c
parentc8dd1e3bb1152844983558802a52c9e4c17652b4 (diff)
parentaeeb2d496859419ac1ba1da1162d6f3610f7f1f3 (diff)
downloadgit-a4f234bf9bd3fb11fb1608a507783d9412af27a9.tar.gz
git-a4f234bf9bd3fb11fb1608a507783d9412af27a9.tar.xz
Merge branch 'jk/ssh-funny-url' into maint-2.7
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/connect.c b/connect.c
index fd7ffe184..d77d39771 100644
--- a/connect.c
+++ b/connect.c
@@ -553,6 +553,11 @@ static struct child_process *git_proxy_connect(int fd[2], char *host)
get_host_and_port(&host, &port);
+ if (looks_like_command_line_option(host))
+ die("strange hostname '%s' blocked", host);
+ if (looks_like_command_line_option(port))
+ die("strange port '%s' blocked", port);
+
proxy = xmalloc(sizeof(*proxy));
child_process_init(proxy);
argv_array_push(&proxy->args, git_proxy_command);
@@ -722,6 +727,9 @@ struct child_process *git_connect(int fd[2], const char *url,
conn = xmalloc(sizeof(*conn));
child_process_init(conn);
+ if (looks_like_command_line_option(path))
+ die("strange pathname '%s' blocked", path);
+
strbuf_addstr(&cmd, prog);
strbuf_addch(&cmd, ' ');
sq_quote_buf(&cmd, path);
@@ -754,6 +762,9 @@ struct child_process *git_connect(int fd[2], const char *url,
return NULL;
}
+ if (looks_like_command_line_option(ssh_host))
+ die("strange hostname '%s' blocked", ssh_host);
+
ssh = getenv("GIT_SSH_COMMAND");
if (!ssh) {
const char *base;