summaryrefslogtreecommitdiff
path: root/builtin-apply.c
diff options
context:
space:
mode:
authorAlex Riesen <raa.lkml@gmail.com>2008-10-26 23:08:52 +0100
committerJunio C Hamano <gitster@pobox.com>2008-10-26 22:10:28 -0700
commit9fa03c177ff826b439537072338af958fe01c257 (patch)
tree913ec88df1b73e0f2ab6c6b5bec06fe179b3d1b2 /builtin-apply.c
parent94cc355287a7efc3eda76af6ae31f503a1ac098b (diff)
downloadgit-9fa03c177ff826b439537072338af958fe01c257.tar.gz
Fix potentially dangerous uses of mkpath and git_path
Replace them with mksnpath/git_snpath and a local buffer for the resulting string. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 e9d49f133a..50b623e54c 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -2850,8 +2850,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;