]> git.ipfire.org Git - thirdparty/git.git/commitdiff
gitk: sanitize 'exec' arguments: redirect to process
authorJohannes Sixt <j6t@kdbg.org>
Sat, 29 Mar 2025 16:35:19 +0000 (17:35 +0100)
committerTaylor Blau <me@ttaylorr.com>
Fri, 23 May 2025 21:03:30 +0000 (17:03 -0400)
Convert one 'exec' call that sends output to a process (pipeline).
Fortunately, the command does not contain any variables. For this
reason, just treat it as a "redirection".

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
gitk

diff --git a/gitk b/gitk
index c0d793f05dc045b45b445152c532057fd5bb979c..9673e56abda6626f287c90b0ea13762250028809 100755 (executable)
--- a/gitk
+++ b/gitk
@@ -43,7 +43,7 @@ proc safe_exec {cmd} {
 # executes one command with redirections
 # no pipelines are possible
 # cmd is a list that specifies the command and its arguments
-# redir is a list that specifies redirections (output, background)
+# redir is a list that specifies redirections (output, background, constant(!) commands)
 # calls `exec` and returns its value
 proc safe_exec_redirect {cmd redir} {
     eval exec [make_arglist_safe $cmd] $redir
@@ -9120,7 +9120,7 @@ proc getpatchid {id} {
     if {![info exists patchids($id)]} {
         set cmd [diffcmd [list $id] {-p --root}]
         if {[catch {
-            set x [eval exec $cmd | git patch-id]
+            set x [safe_exec_redirect $cmd [list | git patch-id]]
             set patchids($id) [lindex $x 0]
         }]} {
             set patchids($id) "error"