@@ -553,6 +553,11 @@ static struct child_process *git_proxy_connect(int fd[2], char *host)
553553
554554 get_host_and_port (& host , & port );
555555
556+ if (looks_like_command_line_option (host ))
557+ die ("strange hostname '%s' blocked" , host );
558+ if (looks_like_command_line_option (port ))
559+ die ("strange port '%s' blocked" , port );
560+
556561 proxy = xmalloc (sizeof (* proxy ));
557562 child_process_init (proxy );
558563 argv_array_push (& proxy -> args , git_proxy_command );
@@ -722,6 +727,9 @@ struct child_process *git_connect(int fd[2], const char *url,
722727 conn = xmalloc (sizeof (* conn ));
723728 child_process_init (conn );
724729
730+ if (looks_like_command_line_option (path ))
731+ die ("strange pathname '%s' blocked" , path );
732+
725733 strbuf_addstr (& cmd , prog );
726734 strbuf_addch (& cmd , ' ' );
727735 sq_quote_buf (& cmd , path );
@@ -754,6 +762,9 @@ struct child_process *git_connect(int fd[2], const char *url,
754762 return NULL ;
755763 }
756764
765+ if (looks_like_command_line_option (ssh_host ))
766+ die ("strange hostname '%s' blocked" , ssh_host );
767+
757768 ssh = getenv ("GIT_SSH_COMMAND" );
758769 if (!ssh ) {
759770 const char * base ;
0 commit comments