Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Fix potentially dangerous uses of mkpath and git_path
author
Alex Riesen
<raa.lkml@gmail.com>
Sun, 26 Oct 2008 22:08:52 +0000
(23:08 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 27 Oct 2008 05:10:28 +0000
(22:10 -0700)
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>
builtin-apply.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
94cc355
)
diff --git
a/builtin-apply.c
b/builtin-apply.c
index e9d49f133afd559d2df3f09997c08a61dfc2ff86..50b623e54c003fb5bbe183568d13f496c3c41c25 100644
(file)
--- 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 (;;) {
- c
onst char *newpath
;
-
newpath = mkpath(
"%s~%u", path, nr);
+ c
har newpath[PATH_MAX]
;
+
mksnpath(newpath, sizeof(newpath),
"%s~%u", path, nr);
if (!try_create_file(newpath, mode, buf, size)) {
if (!rename(newpath, path))
return;