diff options
| author | Johannes Sixt <j6t@kdbg.org> | 2025-03-21 23:34:14 +0100 |
|---|---|---|
| committer | Taylor Blau <me@ttaylorr.com> | 2025-05-23 17:03:30 -0400 |
| commit | 2aeb4484a046a545fb540ba07397b25b13fe6881 (patch) | |
| tree | 1aa7275707c95949e05f82ecd360b7b6609e0b76 | |
| parent | 42a64b41a7a3d01a62f0f34f75bee2bbd00be46f (diff) | |
| download | git-2aeb4484a046a545fb540ba07397b25b13fe6881.tar.gz | |
gitk: sanitize 'open' arguments: simple commands, readable and writable
As in the previous commits, introduce a function that sanitizes
arguments and also keeps the returned file handle writable to pass
data to stdin.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
| -rwxr-xr-x | gitk | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -66,6 +66,13 @@ proc safe_open_command {cmd} { open |[make_arglist_safe $cmd] r } +# opens a command pipeline for reading and writing +# cmd is a list that specifies the command and its arguments +# calls `open` and returns the file id +proc safe_open_command_rw {cmd} { + open |[make_arglist_safe $cmd] r+ +} + # opens a command pipeline for reading with redirections # cmd is a list that specifies the command and its arguments # redir is a list that specifies redirections @@ -4897,8 +4904,8 @@ proc do_file_hl {serial} { # must be "containing:", i.e. we're searching commit info return } - set cmd [concat | git diff-tree -r -s --stdin $gdtargs] - set filehighlight [open $cmd r+] + set cmd [concat git diff-tree -r -s --stdin $gdtargs] + set filehighlight [safe_open_command_rw $cmd] fconfigure $filehighlight -blocking 0 filerun $filehighlight readfhighlight set fhl_list {} |
