@@ -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 );
@@ -726,6 +731,9 @@ struct child_process *git_connect(int fd[2], const char *url,
726731 conn = xmalloc (sizeof (* conn ));
727732 child_process_init (conn );
728733
734+ if (looks_like_command_line_option (path ))
735+ die ("strange pathname '%s' blocked" , path );
736+
729737 strbuf_addstr (& cmd , prog );
730738 strbuf_addch (& cmd , ' ' );
731739 sq_quote_buf (& cmd , path );
@@ -758,6 +766,9 @@ struct child_process *git_connect(int fd[2], const char *url,
758766 return NULL ;
759767 }
760768
769+ if (looks_like_command_line_option (ssh_host ))
770+ die ("strange hostname '%s' blocked" , ssh_host );
771+
761772 ssh = getenv ("GIT_SSH_COMMAND" );
762773 if (!ssh ) {
763774 const char * base ;
0 commit comments