Skip to content

Commit a4d1797

Browse files
committed
Merge branch 'maint-1.6.0' into maint-1.6.1
* maint-1.6.0: doc/git-daemon: add missing arguments to options init: Do not segfault on big GIT_TEMPLATE_DIR environment variable
2 parents 0fa0514 + 6285441 commit a4d1797

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

Documentation/git-daemon.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ OPTIONS
4848
'git-daemon' will refuse to start when this option is enabled and no
4949
whitelist is specified.
5050

51-
--base-path::
51+
--base-path=path::
5252
Remap all the path requests as relative to the given path.
5353
This is sort of "GIT root" - if you run 'git-daemon' with
5454
'--base-path=/srv/git' on example.com, then if you later try to pull
@@ -81,24 +81,24 @@ OPTIONS
8181
Incompatible with --port, --listen, --user and --group options.
8282

8383
--listen=host_or_ipaddr::
84-
Listen on an a specific IP address or hostname. IP addresses can
85-
be either an IPv4 address or an IPV6 address if supported. If IPv6
84+
Listen on a specific IP address or hostname. IP addresses can
85+
be either an IPv4 address or an IPv6 address if supported. If IPv6
8686
is not supported, then --listen=hostname is also not supported and
8787
--listen must be given an IPv4 address.
8888
Incompatible with '--inetd' option.
8989

9090
--port=n::
9191
Listen on an alternative port. Incompatible with '--inetd' option.
9292

93-
--init-timeout::
93+
--init-timeout=n::
9494
Timeout between the moment the connection is established and the
9595
client request is received (typically a rather low value, since
9696
that should be basically immediate).
9797

98-
--timeout::
98+
--timeout=n::
9999
Timeout for specific client sub-requests. This includes the time
100-
it takes for the server to process the sub-request and time spent
101-
waiting for next client's request.
100+
it takes for the server to process the sub-request and the time spent
101+
waiting for the next client's request.
102102

103103
--max-connections::
104104
Maximum number of concurrent clients, defaults to 32. Set it to
@@ -150,7 +150,7 @@ the facility of inet daemon to achieve the same before spawning
150150
Enable/disable the service site-wide per default. Note
151151
that a service disabled site-wide can still be enabled
152152
per repository if it is marked overridable and the
153-
repository enables the service with an configuration
153+
repository enables the service with a configuration
154154
item.
155155

156156
--allow-override=service::

builtin-init-db.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,10 @@ static void copy_templates(const char *template_dir)
122122
template_dir = system_path(DEFAULT_GIT_TEMPLATE_DIR);
123123
if (!template_dir[0])
124124
return;
125+
template_len = strlen(template_dir);
126+
if (PATH_MAX <= (template_len+strlen("/config")))
127+
die("insanely long template path %s", template_dir);
125128
strcpy(template_path, template_dir);
126-
template_len = strlen(template_path);
127129
if (template_path[template_len-1] != '/') {
128130
template_path[template_len++] = '/';
129131
template_path[template_len] = 0;

t/t0001-init.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,13 @@ test_expect_success 'init honors global core.sharedRepository' '
199199
x`git config -f shared-honor-global/.git/config core.sharedRepository`
200200
'
201201

202+
test_expect_success 'init rejects insanely long --template' '
203+
(
204+
insane=$(printf "x%09999dx" 1) &&
205+
mkdir test &&
206+
cd test &&
207+
test_must_fail git init --template=$insane
208+
)
209+
'
210+
202211
test_done

0 commit comments

Comments
 (0)