@@ -577,6 +577,11 @@ static struct child_process *git_proxy_connect(int fd[2], char *host)
577577
578578 get_host_and_port (& host , & port );
579579
580+ if (looks_like_command_line_option (host ))
581+ die ("strange hostname '%s' blocked" , host );
582+ if (looks_like_command_line_option (port ))
583+ die ("strange port '%s' blocked" , port );
584+
580585 proxy = xmalloc (sizeof (* proxy ));
581586 child_process_init (proxy );
582587 argv_array_push (& proxy -> args , git_proxy_command );
@@ -823,6 +828,9 @@ struct child_process *git_connect(int fd[2], const char *url,
823828 conn = xmalloc (sizeof (* conn ));
824829 child_process_init (conn );
825830
831+ if (looks_like_command_line_option (path ))
832+ die ("strange pathname '%s' blocked" , path );
833+
826834 strbuf_addstr (& cmd , prog );
827835 strbuf_addch (& cmd , ' ' );
828836 sq_quote_buf (& cmd , path );
@@ -856,6 +864,9 @@ struct child_process *git_connect(int fd[2], const char *url,
856864 return NULL ;
857865 }
858866
867+ if (looks_like_command_line_option (ssh_host ))
868+ die ("strange hostname '%s' blocked" , ssh_host );
869+
859870 ssh = get_ssh_command ();
860871 if (ssh )
861872 handle_ssh_variant (ssh , 1 , & port_option ,
0 commit comments