Skip to content

Commit d98d109

Browse files
j6tgitster
authored andcommitted
git_connect: remove artificial limit of a remote command
Since day one, function git_connect() had a limit on the command line of the command that is invoked to make a connection. 7a33bcb converted the code that constructs the command to strbuf. This would have been the right time to remove the limit, but it did not happen. Remove it now. git_connect() uses start_command() to invoke the command; consequently, the limits of the system still apply, but are diagnosed only at execve() time. But these limits are more lenient than the 1K that git_connect() imposed. Signed-off-by: Johannes Sixt <[email protected]> Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2171f3d commit d98d109

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

connect.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,6 @@ static struct child_process *git_proxy_connect(int fd[2], char *host)
527527
return proxy;
528528
}
529529

530-
#define MAX_CMD_LEN 1024
531-
532530
static char *get_port(char *host)
533531
{
534532
char *end;
@@ -570,7 +568,7 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
570568
int free_path = 0;
571569
char *port = NULL;
572570
const char **arg;
573-
struct strbuf cmd;
571+
struct strbuf cmd = STRBUF_INIT;
574572

575573
/* Without this we cannot rely on waitpid() to tell
576574
* what happened to our children.
@@ -676,12 +674,9 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
676674

677675
conn = xcalloc(1, sizeof(*conn));
678676

679-
strbuf_init(&cmd, MAX_CMD_LEN);
680677
strbuf_addstr(&cmd, prog);
681678
strbuf_addch(&cmd, ' ');
682679
sq_quote_buf(&cmd, path);
683-
if (cmd.len >= MAX_CMD_LEN)
684-
die("command line too long");
685680

686681
conn->in = conn->out = -1;
687682
conn->argv = arg = xcalloc(7, sizeof(*arg));

0 commit comments

Comments
 (0)