Merge branch 'jk/xstrfmt'
* jk/xstrfmt: setup_git_env(): introduce git_path_from_env() helper unique_path: fix unlikely heap overflow walker_fetch: fix minor memory leak merge: use argv_array when spawning merge strategy sequencer: use argv_array_pushf setup_git_env: use git_pathdup instead of xmalloc + sprintf use xstrfmt to replace xmalloc + strcpy/strcat use xstrfmt to replace xmalloc + sprintf use xstrdup instead of xmalloc + strcpy use xstrfmt in favor of manual size calculations strbuf: add xstrfmt helper
This commit is contained in:
@ -1082,16 +1082,11 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)
|
||||
refs = xcalloc(argc + 1, sizeof(const char *));
|
||||
for (i = 0; i < argc; i++) {
|
||||
if (!strcmp(argv[i], "tag")) {
|
||||
char *ref;
|
||||
i++;
|
||||
if (i >= argc)
|
||||
die(_("You need to specify a tag name."));
|
||||
ref = xmalloc(strlen(argv[i]) * 2 + 22);
|
||||
strcpy(ref, "refs/tags/");
|
||||
strcat(ref, argv[i]);
|
||||
strcat(ref, ":refs/tags/");
|
||||
strcat(ref, argv[i]);
|
||||
refs[j++] = ref;
|
||||
refs[j++] = xstrfmt("refs/tags/%s:refs/tags/%s",
|
||||
argv[i], argv[i]);
|
||||
} else
|
||||
refs[j++] = argv[i];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user