@@ -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 );
@@ -759,6 +764,9 @@ struct child_process *git_connect(int fd[2], const char *url,
759764 conn = xmalloc (sizeof (* conn ));
760765 child_process_init (conn );
761766
767+ if (looks_like_command_line_option (path ))
768+ die ("strange pathname '%s' blocked" , path );
769+
762770 strbuf_addstr (& cmd , prog );
763771 strbuf_addch (& cmd , ' ' );
764772 sq_quote_buf (& cmd , path );
@@ -791,6 +799,9 @@ struct child_process *git_connect(int fd[2], const char *url,
791799 return NULL ;
792800 }
793801
802+ if (looks_like_command_line_option (ssh_host ))
803+ die ("strange hostname '%s' blocked" , ssh_host );
804+
794805 ssh = get_ssh_command ();
795806 if (!ssh ) {
796807 const char * base ;
0 commit comments