mirror of
https://github.com/git/git
synced 2024-08-27 19:49:21 +00:00
gitk: Use mktemp -d to avoid predictable temporary directories
gitk uses a predictable ".gitk-tmp.$PID" pattern when generating a temporary directory. Use "mktemp -d .gitk-tmp.XXXXXX" to harden gitk against someone seeding /tmp with files matching the pid pattern. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
parent
c7664f1a8c
commit
105b5d3fbb
3
gitk
3
gitk
|
@ -3503,7 +3503,8 @@ proc gitknewtmpdir {} {
|
|||
} else {
|
||||
set tmpdir $gitdir
|
||||
}
|
||||
set gitktmpdir [file join $tmpdir [format ".gitk-tmp.%s" [pid]]]
|
||||
set gitktmpformat [file join $tmpdir ".gitk-tmp.XXXXXX"]
|
||||
set gitktmpdir [exec mktemp -d $gitktmpformat]
|
||||
if {[catch {file mkdir $gitktmpdir} err]} {
|
||||
error_popup "[mc "Error creating temporary directory %s:" $gitktmpdir] $err"
|
||||
unset gitktmpdir
|
||||
|
|
Loading…
Reference in a new issue