Merge branch 'maint-1.6.0' into maint
[gitweb.git] / builtin-init-db.c
index 8199e5d4d5168859363b7a644535fd0cb01a1441..bfdfc7b411fb463f06ba98f58c07f5e707813310 100644 (file)
@@ -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;