aboutsummaryrefslogtreecommitdiffstats
path: root/git-gui/lib/win32.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/win32.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/win32.tcl')
-rw-r--r--git-gui/lib/win32.tcl9
1 files changed, 5 insertions, 4 deletions
diff --git a/git-gui/lib/win32.tcl b/git-gui/lib/win32.tcl
index db91ab84a5..3aedae2f13 100644
--- a/git-gui/lib/win32.tcl
+++ b/git-gui/lib/win32.tcl
@@ -2,11 +2,11 @@
# Copyright (C) 2007 Shawn Pearce
proc win32_read_lnk {lnk_path} {
- return [exec cscript.exe \
+ return [safe_exec [list cscript.exe \
/E:jscript \
/nologo \
[file join $::oguilib win32_shortcut.js] \
- $lnk_path]
+ $lnk_path]]
}
proc win32_create_lnk {lnk_path lnk_exec lnk_dir} {
@@ -15,12 +15,13 @@ proc win32_create_lnk {lnk_path lnk_exec lnk_dir} {
set lnk_args [lrange $lnk_exec 1 end]
set lnk_exec [lindex $lnk_exec 0]
- eval [list exec wscript.exe \
+ set cmd [list wscript.exe \
/E:jscript \
/nologo \
[file nativename [file join $oguilib win32_shortcut.js]] \
$lnk_path \
[file nativename [file join $oguilib git-gui.ico]] \
$lnk_dir \
- $lnk_exec] $lnk_args
+ $lnk_exec]
+ safe_exec [concat $cmd $lnk_args]
}