Skip to content

Commit 7a0493e

Browse files
j6tttaylorr
authored andcommitted
gitk: sanitize 'exec' arguments: redirections and background
Convert 'exec' calls that both redirect output to a file and run the process in the background. 'safe_exec_redirect' can take both these "redirections" in the second argument simultaneously. Signed-off-by: Johannes Sixt <[email protected]> Signed-off-by: Taylor Blau <[email protected]>
1 parent 6b631ee commit 7a0493e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

gitk

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9363,8 +9363,7 @@ proc mkpatchgo {} {
93639363
set newid [$patchtop.tosha1 get]
93649364
set fname [$patchtop.fname get]
93659365
set cmd [diffcmd [list $oldid $newid] -p]
9366-
lappend cmd >$fname &
9367-
if {[catch {eval exec $cmd} err]} {
9366+
if {[catch {safe_exec_redirect $cmd [list >$fname &]} err]} {
93689367
error_popup "[mc "Error creating patch:"] $err" $patchtop
93699368
}
93709369
catch {destroy $patchtop}
@@ -9553,7 +9552,7 @@ proc wrcomgo {} {
95539552
set id [$wrcomtop.sha1 get]
95549553
set cmd "echo $id | [$wrcomtop.cmd get]"
95559554
set fname [$wrcomtop.fname get]
9556-
if {[catch {exec sh -c $cmd >$fname &} err]} {
9555+
if {[catch {safe_exec_redirect [list sh -c $cmd] [list >$fname &]} err]} {
95579556
error_popup "[mc "Error writing commit:"] $err" $wrcomtop
95589557
}
95599558
catch {destroy $wrcomtop}

0 commit comments

Comments
 (0)