summaryrefslogtreecommitdiff
path: root/builtin-apply.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-10-26 22:24:44 -0700
committerJunio C Hamano <gitster@pobox.com>2008-10-26 22:24:44 -0700
commit356af64d84076baaf90b0bf8adb7245771264e5a (patch)
tree008ecc6fdb6323d2bac3e09be6dce5b0de5f64cb /builtin-apply.c
parent304d058370a9a797c38ec739c6d39fa45d9ed8e5 (diff)
parent9fa03c177ff826b439537072338af958fe01c257 (diff)
downloadgit-356af64d84076baaf90b0bf8adb7245771264e5a.tar.gz
Merge branch 'ar/maint-mksnpath' into HEAD
* ar/maint-mksnpath: Fix potentially dangerous uses of mkpath and git_path Fix mkpath abuse in dwim_ref and dwim_log of sha1_name.c Add mksnpath which allows you to specify the output buffer
Diffstat (limited to 'builtin-apply.c')
-rw-r--r--builtin-apply.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin-apply.c b/builtin-apply.c
index cfd8fceb90..4c4d1e1774 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -2841,8 +2841,8 @@ static void create_one_file(char *path, unsigned mode, const char *buf, unsigned
unsigned int nr = getpid();
for (;;) {
- const char *newpath;
- newpath = mkpath("%s~%u", path, nr);
+ char newpath[PATH_MAX];
+ mksnpath(newpath, sizeof(newpath), "%s~%u", path, nr);
if (!try_create_file(newpath, mode, buf, size)) {
if (!rename(newpath, path))
return;