aboutsummaryrefslogtreecommitdiff
path: root/builtin-init-db.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-04-18 14:43:24 -0700
committerJunio C Hamano <gitster@pobox.com>2009-04-18 14:43:24 -0700
commita4d1797332bca95635168032c90765a41eacdc7a (patch)
tree70a934732e18e9420044f0c11abd88447e49e03b /builtin-init-db.c
parent0fa0514b9172186d018c884da296ac6705c3e07c (diff)
parent62854410449ec407a363e4bb1dc980a75aa1699d (diff)
downloadgit-a4d1797332bca95635168032c90765a41eacdc7a.tar.gz
git-a4d1797332bca95635168032c90765a41eacdc7a.tar.xz
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
Diffstat (limited to 'builtin-init-db.c')
-rw-r--r--builtin-init-db.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin-init-db.c b/builtin-init-db.c
index d30c3fe2c..6cc945d50 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -122,8 +122,10 @@ static void copy_templates(const char *template_dir)
template_dir = system_path(DEFAULT_GIT_TEMPLATE_DIR);
if (!template_dir[0])
return;
+ template_len = strlen(template_dir);
+ if (PATH_MAX <= (template_len+strlen("/config")))
+ die("insanely long template path %s", template_dir);
strcpy(template_path, template_dir);
- template_len = strlen(template_path);
if (template_path[template_len-1] != '/') {
template_path[template_len++] = '/';
template_path[template_len] = 0;