summaryrefslogtreecommitdiff
path: root/sha1_name.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-07-09 11:34:05 -0700
committerJunio C Hamano <gitster@pobox.com>2014-07-09 11:34:05 -0700
commit3b8e8af187cb86ed030432f1a067121fdd4b1c3b (patch)
treedd8cdaa18cfd70d6cfe6b0a3120fccb5f0a971cd /sha1_name.c
parente91ae32a01ffe294b8510c1d8cd7138493a0712f (diff)
parentcb6c38d5cce7d8d48a57346b332a68cea1489df1 (diff)
downloadgit-3b8e8af187cb86ed030432f1a067121fdd4b1c3b.tar.gz
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
Diffstat (limited to 'sha1_name.c')
-rw-r--r--sha1_name.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/sha1_name.c b/sha1_name.c
index a91e0c924b..5bfa841699 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -1240,10 +1240,7 @@ static void diagnose_invalid_sha1_path(const char *prefix,
die("Path '%s' exists on disk, but not in '%.*s'.",
filename, object_name_len, object_name);
if (errno == ENOENT || errno == ENOTDIR) {
- char *fullname = xmalloc(strlen(filename)
- + strlen(prefix) + 1);
- strcpy(fullname, prefix);
- strcat(fullname, filename);
+ char *fullname = xstrfmt("%s%s", prefix, filename);
if (!get_tree_entry(tree_sha1, fullname,
sha1, &mode)) {