Commit 517bd0d3 by Carlos Martín Nieto

ssh: reject suspicious path

Like in the previous commit and in git, we reject a path that looks like an
option to avoid injection into the command we ask the remote to execute.
parent cf7477a8
......@@ -788,6 +788,15 @@ static int _git_ssh_setup_conn(
if (error < 0)
goto done;
/* Safety check: like git, we forbid paths that look like an option as
* that could lead to injection on the remote side */
if (git_net_looks_like_command_line_option(s->url.path)) {
git_error_set(GIT_ERROR_NET, "strange path '%s' blocked", s->url.path);
error = -1;
goto done;
}
if ((error = git_socket_stream_new(&s->io, s->url.host, s->url.port)) < 0 ||
(error = git_stream_connect(s->io)) < 0)
goto done;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment