summaryrefslogtreecommitdiff
path: root/daemon.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-06-07 06:49:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-06-07 06:49:28 (GMT)
commit3ff7e178dc5c93e9d5b2738b1738a1a230a1b81a (patch)
tree390381a4758d234cd6ce6b33633eab511d1966fb /daemon.c
parent6096d7598058d920485d206477f4383ba1a862cb (diff)
parent801a011dcf41f0415dee81f0500673e058bdee30 (diff)
downloadgit-3ff7e178dc5c93e9d5b2738b1738a1a230a1b81a.zip
git-3ff7e178dc5c93e9d5b2738b1738a1a230a1b81a.tar.gz
git-3ff7e178dc5c93e9d5b2738b1738a1a230a1b81a.tar.bz2
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.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/daemon.c b/daemon.c
index daa4c8e..b2babcc 100644
--- a/daemon.c
+++ b/daemon.c
@@ -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]);