{"thread":{"id":"35424","subject":"[PATCH v7 03/10] git_connect: remove artificial limit of a remote command","startedAt":"2013-11-28T19:48:45Z","lastAt":"2013-11-28T19:48:45Z","messageCount":1,"participants":["Torsten Bögershausen"],"isPatch":true,"patchVersion":7,"patchTotal":10},"messages":[{"id":"231254","messageId":"201311282048.45739.tboegi@web.de","threadId":"35424","inReplyTo":null,"subject":"[PATCH v7 03/10] git_connect: remove artificial limit of a remote command","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2013-11-28T19:48:45Z","receivedAt":"2013-11-28T19:48:45Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"Since day one, function git_connect() had a limit on the command line of\nthe command that is invoked to make a connection. 7a33bcbe converted the\ncode that constructs the command to strbuf. This would have been the\nright time to remove the limit, but it did not happen. Remove it now.\n\ngit_connect() uses start_command() to invoke the command; consequently,\nthe limits of the system still apply, but are diagnosed only at execve()\ntime. But these limits are more lenient than the 1K that git_connect()\nimposed.\n\nSigned-off-by: Johannes Sixt <j6t@kdbg.org>\nSigned-off-by: Torsten Bögershausen <tboegi@web.de>\n---\n connect.c | 7 +------\n 1 file changed, 1 insertion(+), 6 deletions(-)\n\ndiff --git a/connect.c b/connect.c\nindex 06e88b0..6cc1f8d 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -527,8 +527,6 @@ static struct child_process *git_proxy_connect(int fd[2], char *host)\n \treturn proxy;\n }\n \n-#define MAX_CMD_LEN 1024\n-\n static char *get_port(char *host)\n {\n \tchar *end;\n@@ -570,7 +568,7 @@ struct child_process *git_connect(int fd[2], const char *url_orig,\n \tint free_path = 0;\n \tchar *port = NULL;\n \tconst char **arg;\n-\tstruct strbuf cmd;\n+\tstruct strbuf cmd = STRBUF_INIT;\n \n \t/* Without this we cannot rely on waitpid() to tell\n \t * what happened to our children.\n@@ -676,12 +674,9 @@ struct child_process *git_connect(int fd[2], const char *url_orig,\n \n \tconn = xcalloc(1, sizeof(*conn));\n \n-\tstrbuf_init(&cmd, MAX_CMD_LEN);\n \tstrbuf_addstr(&cmd, prog);\n \tstrbuf_addch(&cmd, ' ');\n \tsq_quote_buf(&cmd, path);\n-\tif (cmd.len >= MAX_CMD_LEN)\n-\t\tdie(\"command line too long\");\n \n \tconn->in = conn->out = -1;\n \tconn->argv = arg = xcalloc(7, sizeof(*arg));\n-- \n1.8.5.rc0.23.gaa27064\n"}]}