Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-07-09 22:34:05 +0400
committerJunio C Hamano <gitster@pobox.com>2014-07-09 22:34:05 +0400
commit3b8e8af187cb86ed030432f1a067121fdd4b1c3b (patch)
treedd8cdaa18cfd70d6cfe6b0a3120fccb5f0a971cd /builtin/apply.c
parente91ae32a01ffe294b8510c1d8cd7138493a0712f (diff)
parentcb6c38d5cce7d8d48a57346b332a68cea1489df1 (diff)
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 'builtin/apply.c')
-rw-r--r--builtin/apply.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/builtin/apply.c b/builtin/apply.c
index bc924ab2d0..16cc93587f 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -1281,9 +1281,7 @@ static int parse_git_header(const char *line, int len, unsigned int size, struct
*/
patch->def_name = git_header_name(line, len);
if (patch->def_name && root) {
- char *s = xmalloc(root_len + strlen(patch->def_name) + 1);
- strcpy(s, root);
- strcpy(s + root_len, patch->def_name);
+ char *s = xstrfmt("%s%s", root, patch->def_name);
free(patch->def_name);
patch->def_name = s;
}