diff options
| author | Paul Buetow <paul@buetow.org> | 2026-07-20 16:37:52 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-07-20 16:37:52 +0300 |
| commit | 220b3806e97da745bad6f3b42fd6dfabd4e28c0b (patch) | |
| tree | 6f1c91a3868908e775ccb29f72d6f5c04b0b78d6 /src/texturecache.c | |
| parent | dc430ce8ec427529c75e3527a0ff01fcf3858dd2 (diff) | |
runner: pass full expanded command as one sh -c arg (8u0)
runner_run built "/bin/sh -c " + cmd and ran g_shell_parse_argv on it,
which split the command into argv words — sh -c then received only the
first word as its script and treated the rest as $0/$1..., silently
truncating multi-word commands, pipelines, and redirections. The
existing 'true %f' test passed only because true ignores missing args.
Build argv directly as {"/bin/sh", "-c", c_cmd, NULL} so sh -c gets
the whole expanded command as one script string. %f/%d stay single-
quoted via g_shell_quote, so hostile filenames cannot break out of the
quotes and inject commands. Also removed dead code in _shell_quote.
New observable tests (write to a temp file, read it back):
- multi_word: printf 'hello world' (would fail on old code)
- pipeline: echo | cat
- redirection: echo > file
- spaces_in_args: printf 'a b c'
- hostile_filename: ';touch sentinel;' name must NOT create the sentinel
Diffstat (limited to 'src/texturecache.c')
0 files changed, 0 insertions, 0 deletions
