@@ -557,6 +557,11 @@ static struct child_process *git_proxy_connect(int fd[2], char *host)
557557
558558 get_host_and_port (& host , & port );
559559
560+ if (looks_like_command_line_option (host ))
561+ die ("strange hostname '%s' blocked" , host );
562+ if (looks_like_command_line_option (port ))
563+ die ("strange port '%s' blocked" , port );
564+
560565 proxy = xmalloc (sizeof (* proxy ));
561566 child_process_init (proxy );
562567 argv_array_push (& proxy -> args , git_proxy_command );
@@ -739,6 +744,9 @@ struct child_process *git_connect(int fd[2], const char *url,
739744 conn = xmalloc (sizeof (* conn ));
740745 child_process_init (conn );
741746
747+ if (looks_like_command_line_option (path ))
748+ die ("strange pathname '%s' blocked" , path );
749+
742750 strbuf_addstr (& cmd , prog );
743751 strbuf_addch (& cmd , ' ' );
744752 sq_quote_buf (& cmd , path );
@@ -771,6 +779,9 @@ struct child_process *git_connect(int fd[2], const char *url,
771779 return NULL ;
772780 }
773781
782+ if (looks_like_command_line_option (ssh_host ))
783+ die ("strange hostname '%s' blocked" , ssh_host );
784+
774785 ssh = get_ssh_command ();
775786 if (!ssh ) {
776787 const char * base ;
0 commit comments