diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-06-06 23:49:28 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-06-06 23:49:28 -0700 |
commit | 3ff7e178dc5c93e9d5b2738b1738a1a230a1b81a (patch) | |
tree | 390381a4758d234cd6ce6b33633eab511d1966fb /daemon.c | |
parent | 6096d7598058d920485d206477f4383ba1a862cb (diff) | |
parent | 801a011dcf41f0415dee81f0500673e058bdee30 (diff) | |
download | git-3ff7e178dc5c93e9d5b2738b1738a1a230a1b81a.tar.gz |
Merge branch 'maint'
* maint:
Documentation: refer to gitworkflows(7) from tutorial and git(1)
daemon: Strictly parse the "extra arg" part of the command
Diffstat (limited to 'daemon.c')
-rw-r--r-- | daemon.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -406,15 +406,15 @@ static char *xstrdup_tolower(const char *str) } /* - * Separate the "extra args" information as supplied by the client connection. + * Read the host as supplied by the client connection. */ -static void parse_extra_args(char *extra_args, int buflen) +static void parse_host_arg(char *extra_args, int buflen) { char *val; int vallen; char *end = extra_args + buflen; - while (extra_args < end && *extra_args) { + if (extra_args < end && *extra_args) { saw_extended_args = 1; if (strncasecmp("host=", extra_args, 5) == 0) { val = extra_args + 5; @@ -436,6 +436,8 @@ static void parse_extra_args(char *extra_args, int buflen) /* On to the next one */ extra_args = val + vallen; } + if (extra_args < end && *extra_args) + die("Invalid request"); } /* @@ -545,7 +547,7 @@ static int execute(struct sockaddr *addr) hostname = canon_hostname = ip_address = tcp_port = NULL; if (len != pktlen) - parse_extra_args(line + len + 1, pktlen - len - 1); + parse_host_arg(line + len + 1, pktlen - len - 1); for (i = 0; i < ARRAY_SIZE(daemon_service); i++) { struct daemon_service *s = &(daemon_service[i]); |