diff --git a/daemon.c b/daemon.c index e37e343d0a..d78afc8e96 100644 --- a/daemon.c +++ b/daemon.c @@ -759,8 +759,8 @@ static int execute(void) len = strlen(line); if (pktlen != len) loginfo("Extended attributes (%d bytes) exist <%.*s>", - (int) pktlen - len, - (int) pktlen - len, line + len + 1); + (int) pktlen - len - 1, + (int) pktlen - len - 1, line + len + 1); if (len && line[len-1] == '\n') { line[--len] = 0; pktlen--; diff --git a/t/t5570-git-daemon.sh b/t/t5570-git-daemon.sh index f92ebc5cd5..359af3994a 100755 --- a/t/t5570-git-daemon.sh +++ b/t/t5570-git-daemon.sh @@ -183,5 +183,16 @@ test_expect_success 'hostname cannot break out of directory' ' git ls-remote "$GIT_DAEMON_URL/escape.git" ' +test_expect_success 'daemon log records hostnames' ' + cat >expect <<-\EOF && + Extended attributes (15 bytes) exist + EOF + >daemon.log && + GIT_OVERRIDE_VIRTUAL_HOST=localhost \ + git ls-remote "$GIT_DAEMON_URL/interp.git" && + grep -i extended.attribute daemon.log | cut -d" " -f2- >actual && + test_cmp expect actual +' + stop_git_daemon test_done