@@ -578,6 +578,11 @@ static struct child_process *git_proxy_connect(int fd[2], char *host)
578578
579579 get_host_and_port (& host , & port );
580580
581+ if (looks_like_command_line_option (host ))
582+ die ("strange hostname '%s' blocked" , host );
583+ if (looks_like_command_line_option (port ))
584+ die ("strange port '%s' blocked" , port );
585+
581586 proxy = xmalloc (sizeof (* proxy ));
582587 child_process_init (proxy );
583588 argv_array_push (& proxy -> args , git_proxy_command );
@@ -824,6 +829,9 @@ struct child_process *git_connect(int fd[2], const char *url,
824829 conn = xmalloc (sizeof (* conn ));
825830 child_process_init (conn );
826831
832+ if (looks_like_command_line_option (path ))
833+ die ("strange pathname '%s' blocked" , path );
834+
827835 strbuf_addstr (& cmd , prog );
828836 strbuf_addch (& cmd , ' ' );
829837 sq_quote_buf (& cmd , path );
@@ -857,6 +865,9 @@ struct child_process *git_connect(int fd[2], const char *url,
857865 return NULL ;
858866 }
859867
868+ if (looks_like_command_line_option (ssh_host ))
869+ die ("strange hostname '%s' blocked" , ssh_host );
870+
860871 ssh = get_ssh_command ();
861872 if (ssh )
862873 handle_ssh_variant (ssh , 1 , & port_option ,
0 commit comments