]> git.ipfire.org Git - thirdparty/systemd.git/commit
tree-wide: add basic validation of --background argument
authorDaniel Hast <hast.daniel@protonmail.com>
Fri, 24 Oct 2025 22:47:59 +0000 (18:47 -0400)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 25 Oct 2025 00:56:31 +0000 (09:56 +0900)
commit101dd41cb43fdb733dca3c752d94e9adadc17b07
tree56e1364ffaa2b6ce4448a6fa0278215925ab0b30
parent6fac8bb9b1f42bd08236dfc53cf8c37e66a72212
tree-wide: add basic validation of --background argument

Check whether the argument of the `--background` option of
`systemd-run`, `run0`, `systemd-nspawn`, `systemd-vmspawn`, and
`systemd-pty-forward` is either empty or looks like an ANSI color code,
and reject invalid values when parsing arguments.

We consider a string to look like an ANSI color code if it consists of
one or more sequences of ASCII digits separated by semicolons. This
permits every valid ANSI color code, and should reject anything that
results in garbled output.
src/basic/ansi-color.c
src/basic/ansi-color.h
src/nspawn/nspawn.c
src/ptyfwd/ptyfwd-tool.c
src/run/run.c
src/shared/parse-argument.c
src/shared/parse-argument.h
src/test/test-parse-argument.c
src/vmspawn/vmspawn.c