path: root/builtin/init-db.c
diff options
authorJeff King <>2015-10-05 03:45:26 (GMT)
committerJunio C Hamano <>2015-10-05 18:06:49 (GMT)
commitfdf729661a777d8bd598f40055d92b2df5601332 (patch)
treef550af4a1bab89529aa73accc8e08a6a43b2f3a3 /builtin/init-db.c
parente2b021eb5b5ce2f4be3c10f1f8063981b1a53053 (diff)
probe_utf8_pathname_composition: use internal strbuf
When we are initializing a .git directory, we may call probe_utf8_pathname_composition to detect utf8 mangling. We pass in a path buffer for it to use, and it blindly strcpy()s into it, not knowing whether the buffer is large enough to hold the result or not. In practice this isn't a big deal, because the buffer we pass in already contains "$GIT_DIR/config", and we append only a few extra bytes to it. But we can easily do the right thing just by calling git_path_buf ourselves. Technically this results in a different pathname (before we appended our utf8 characters to the "config" path, and now they get their own files in $GIT_DIR), but that should not matter for our purposes. Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin/init-db.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/init-db.c b/builtin/init-db.c
index e7d0e31..89addda 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -312,7 +312,7 @@ static int create_default_files(const char *template_path)
strcpy(path + len, "CoNfIg");
if (!access(path, F_OK))
git_config_set("core.ignorecase", "true");
- probe_utf8_pathname_composition(path, len);
+ probe_utf8_pathname_composition();
return reinit;