From 85d46c79c53ea73d76e5146523c09603788bcb2a Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Sun, 31 Jul 2022 17:34:40 -0300 Subject: git: Use `format_len()` instead of `strlen()` when creating the repo path in `init_git()` --- git.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git.c b/git.c index da9386d..7b2fd6d 100644 --- a/git.c +++ b/git.c @@ -718,7 +718,7 @@ git_repo **init_git(config *cfg) { if (entry.d_type == DT_DIR) { /* Is the entry neither ".", nor ".."? */ if (strcmp(entry.d_name, ".") && strcmp(entry.d_name, "..")) { - char *repo_dir = calloc(strlen(cfg->git_root) + strlen(entry.d_name) + 2, sizeof(char)); + char *repo_dir = calloc(format_len("%s/%s", cfg->git_root, entry.d_name), sizeof(char)); /* Append the directory name to the git root. */ /* Could also do this: -- cgit v1.2.3-13-gbd6f