aboutsummaryrefslogtreecommitdiffstats
path: root/git-gui/lib/remote.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/remote.tcl
parenta7d1716fa648f6557ea9c91e0f04bae2e8738e6a (diff)
parenta437f5bc93330a70b42a230e52f3bd036ca1b1da (diff)
downloadgit-311d9ada3a7c2c49669d656a0359cc3a9ccfeeef.tar.gz
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/remote.tcl')
-rw-r--r--git-gui/lib/remote.tcl8
1 files changed, 4 insertions, 4 deletions
diff --git a/git-gui/lib/remote.tcl b/git-gui/lib/remote.tcl
index ef77ed7399..cf796d1601 100644
--- a/git-gui/lib/remote.tcl
+++ b/git-gui/lib/remote.tcl
@@ -32,7 +32,7 @@ proc all_tracking_branches {} {
}
if {$pat ne {}} {
- set fd [eval git_read for-each-ref --format=%(refname) $cmd]
+ set fd [git_read [concat for-each-ref --format=%(refname) $cmd]]
while {[gets $fd n] > 0} {
foreach spec $pat {
set dst [string range [lindex $spec 0] 0 end-2]
@@ -75,7 +75,7 @@ proc load_all_remotes {} {
foreach name $all_remotes {
catch {
- set fd [open [file join $rm_dir $name] r]
+ set fd [safe_open_file [file join $rm_dir $name] r]
while {[gets $fd line] >= 0} {
if {[regexp {^URL:[ ]*(.+)$} $line line url]} {
set remote_url($name) $url
@@ -145,7 +145,7 @@ proc add_fetch_entry {r} {
}
} else {
catch {
- set fd [open [gitdir remotes $r] r]
+ set fd [safe_open_file [gitdir remotes $r] r]
while {[gets $fd n] >= 0} {
if {[regexp {^Pull:[ \t]*([^:]+):} $n]} {
set enable 1
@@ -182,7 +182,7 @@ proc add_push_entry {r} {
}
} else {
catch {
- set fd [open [gitdir remotes $r] r]
+ set fd [safe_open_file [gitdir remotes $r] r]
while {[gets $fd n] >= 0} {
if {[regexp {^Push:[ \t]*([^:]+):} $n]} {
set enable 1