diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-07-09 11:34:05 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-07-09 11:34:05 -0700 |
commit | 3b8e8af187cb86ed030432f1a067121fdd4b1c3b (patch) | |
tree | dd8cdaa18cfd70d6cfe6b0a3120fccb5f0a971cd /sha1_name.c | |
parent | e91ae32a01ffe294b8510c1d8cd7138493a0712f (diff) | |
parent | cb6c38d5cce7d8d48a57346b332a68cea1489df1 (diff) | |
download | git-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.c | 5 |
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)) { |