git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] gitk: use mktemp -d to avoid predictable temporary directories
@ 2014-06-13 21:43 David Aguilar
  2014-06-15  4:57 ` Paul Mackerras
  2014-06-15  7:51 ` Pat Thoyts
  0 siblings, 2 replies; 9+ messages in thread
From: David Aguilar @ 2014-06-13 21:43 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: git

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>
---
This issue was brought up during the first review of the previous patch
back in 2009.

http://thread.gmane.org/gmane.comp.version-control.git/132609/focus=132748

This is really [PATCH 2/2] and should be applied on top of my previous
gitk patch.

 gitk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gitk b/gitk
index 82293dd..dd2ff63 100755
--- a/gitk
+++ b/gitk
@@ -3502,7 +3502,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
-- 
2.0.0.257.g75cc6c6

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-06-19  2:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-13 21:43 [PATCH] gitk: use mktemp -d to avoid predictable temporary directories David Aguilar
2014-06-15  4:57 ` Paul Mackerras
2014-06-15  7:51 ` Pat Thoyts
2014-06-15 16:32   ` brian m. carlson
2014-06-15 21:49     ` David Aguilar
2014-06-15 22:16       ` brian m. carlson
2014-06-16 18:17       ` Junio C Hamano
2014-06-19  2:54         ` David Aguilar
2014-06-16 11:40   ` Thomas Braun

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).