aboutsummaryrefslogtreecommitdiffstats
path: root/git-gui/lib/choose_rev.tcl
diff options
context:
space:
mode:
authorJohannes Sixt <j6t@kdbg.org>2025-05-20 08:56:09 +0200
committerTaylor Blau <me@ttaylorr.com>2025-05-23 17:04:31 -0400
commit311d9ada3a7c2c49669d656a0359cc3a9ccfeeef (patch)
tree2a415d4e14344093eda9d6e2a0daa026ae564989 /git-gui/lib/choose_rev.tcl
parentMerge branch 'ml/replace-auto-execok' (diff)
parentgit-gui: sanitize 'exec' arguments: convert new 'cygpath' calls (diff)
downloadgit-311d9ada3a7c2c49669d656a0359cc3a9ccfeeef.tar.gz
git-311d9ada3a7c2c49669d656a0359cc3a9ccfeeef.zip
Merge branch 'js/fix-open-exec'
This addresses CVE-2025-46835, Git GUI can create and overwrite a user's files: When a user clones an untrusted repository and is tricked into editing a file located in a maliciously named directory in the repository, then Git GUI can create and overwrite files for which the user has write permission. Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Diffstat (limited to 'git-gui/lib/choose_rev.tcl')
-rw-r--r--git-gui/lib/choose_rev.tcl8
1 files changed, 4 insertions, 4 deletions
diff --git a/git-gui/lib/choose_rev.tcl b/git-gui/lib/choose_rev.tcl
index 6dae7937d5..8ae7e8a5c4 100644
--- a/git-gui/lib/choose_rev.tcl
+++ b/git-gui/lib/choose_rev.tcl
@@ -146,14 +146,14 @@ constructor _new {path unmerged_only title} {
append fmt { %(*subject)}
append fmt {]}
set all_refn [list]
- set fr_fd [git_read for-each-ref \
+ set fr_fd [git_read [list for-each-ref \
--tcl \
--sort=-taggerdate \
--format=$fmt \
refs/heads \
refs/remotes \
refs/tags \
- ]
+ ]]
fconfigure $fr_fd -translation lf -encoding utf-8
while {[gets $fr_fd line] > 0} {
set line [eval $line]
@@ -176,7 +176,7 @@ constructor _new {path unmerged_only title} {
close $fr_fd
if {$unmerged_only} {
- set fr_fd [git_read rev-list --all ^$::HEAD]
+ set fr_fd [git_read [list rev-list --all ^$::HEAD]]
while {[gets $fr_fd sha1] > 0} {
if {[catch {set rlst $cmt_refn($sha1)}]} continue
foreach refn $rlst {
@@ -579,7 +579,7 @@ method _reflog_last {name} {
set last {}
if {[catch {set last [file mtime [gitdir $name]]}]
- && ![catch {set g [open [gitdir logs $name] r]}]} {
+ && ![catch {set g [safe_open_file [gitdir logs $name] r]}]} {
fconfigure $g -translation binary
while {[gets $g line] >= 0} {
if {[regexp {> ([1-9][0-9]*) } $line line when]} {