@@ -577,6 +577,11 @@ static struct child_process *git_proxy_connect(int fd[2], char *host)
577
577
578
578
get_host_and_port (& host , & port );
579
579
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
+
580
585
proxy = xmalloc (sizeof (* proxy ));
581
586
child_process_init (proxy );
582
587
argv_array_push (& proxy -> args , git_proxy_command );
@@ -823,6 +828,9 @@ struct child_process *git_connect(int fd[2], const char *url,
823
828
conn = xmalloc (sizeof (* conn ));
824
829
child_process_init (conn );
825
830
831
+ if (looks_like_command_line_option (path ))
832
+ die ("strange pathname '%s' blocked" , path );
833
+
826
834
strbuf_addstr (& cmd , prog );
827
835
strbuf_addch (& cmd , ' ' );
828
836
sq_quote_buf (& cmd , path );
@@ -856,6 +864,9 @@ struct child_process *git_connect(int fd[2], const char *url,
856
864
return NULL ;
857
865
}
858
866
867
+ if (looks_like_command_line_option (ssh_host ))
868
+ die ("strange hostname '%s' blocked" , ssh_host );
869
+
859
870
ssh = get_ssh_command ();
860
871
if (ssh )
861
872
handle_ssh_variant (ssh , 1 , & port_option ,
0 commit comments