Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 105b5d3

Browse files
davvidpaulusmack
authored andcommitted
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 <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent c7664f1 commit 105b5d3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

gitk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3503,7 +3503,8 @@ proc gitknewtmpdir {} {
35033503
} else {
35043504
set tmpdir $gitdir
35053505
}
3506-
set gitktmpdir [file join $tmpdir [format ".gitk-tmp.%s" [pid]]]
3506+
set gitktmpformat [file join $tmpdir ".gitk-tmp.XXXXXX"]
3507+
set gitktmpdir [exec mktemp -d $gitktmpformat]
35073508
if {[catch {file mkdir $gitktmpdir} err]} {
35083509
error_popup "[mc "Error creating temporary directory %s:" $gitktmpdir] $err"
35093510
unset gitktmpdir

0 commit comments

Comments
 (0)