summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-10-23 18:26:05 -0700
committerJunio C Hamano <junkio@cox.net>2006-10-23 18:26:05 -0700
commit83543a24c316de60b886cd98272fde2bcc99d558 (patch)
treec4a66e1ce7a9be7d2955fd6c0f4a806acc9fe786
parent67aef034551aed0cc417e8b758a59b9978c4f3f1 (diff)
downloadgit-83543a24c316de60b886cd98272fde2bcc99d558.tar.gz
daemon: do not die on older clients.
In the older times, the clients did not say which host they were trying to connect, and the code we recently added did not quite handle the older clients correctly. Noticed by Simon Arlott. Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--daemon.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/daemon.c b/daemon.c
index ad8492873e..e66bb802da 100644
--- a/daemon.c
+++ b/daemon.c
@@ -450,6 +450,8 @@ void fill_in_extra_table_entries(struct interp *itable)
* Replace literal host with lowercase-ized hostname.
*/
hp = interp_table[INTERP_SLOT_HOST].value;
+ if (!hp)
+ return;
for ( ; *hp; hp++)
*hp = tolower(*hp);
@@ -544,8 +546,10 @@ static int execute(struct sockaddr *addr)
loginfo("Extended attributes (%d bytes) exist <%.*s>",
(int) pktlen - len,
(int) pktlen - len, line + len + 1);
- if (len && line[len-1] == '\n')
+ if (len && line[len-1] == '\n') {
line[--len] = 0;
+ pktlen--;
+ }
/*
* Initialize the path interpolation table for this connection.