diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2022-04-21 17:45:56 +0200 |
---|---|---|
committer | Mike Frysinger <vapier@gmail.com> | 2022-04-21 13:44:44 -0400 |
commit | f81bb7e2c4ee8d8c070e2bd212562cc4315edf3a (patch) | |
tree | 50d36f8705e89a3f608dd5a2eebbaa565dfbf7be | |
parent | b5f713124b043e287d2b0db252088c69533b9e63 (diff) |
seedrng: use posix positional params to avoid space splitting
The value of ${seed_dir} may have spaces in it, making the current
argument string building method unsafe. Instead, use positional
parameters to pass these arguments safely.
-rw-r--r-- | init.d/seedrng.in | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/init.d/seedrng.in b/init.d/seedrng.in index 10fb931d..15dd3f54 100644 --- a/init.d/seedrng.in +++ b/init.d/seedrng.in @@ -19,18 +19,18 @@ depend() provide urandom } -seedrng_options() +seedrng_with_options() { - [ -n "${seed_dir}" ] && - echo "--seed-dir \"${seed_dir}\"" - yesno "${skip_credit}" && - echo "--skip-credit" + set -- + [ -n "${seed_dir}" ] && set -- "$@" --seed-dir "${seed_dir}" + yesno "${skip_credit}" && set -- "$@" --skip-credit + seedrng "$@" } start() { ebegin "Seeding random number generator" - seedrng $(seedrng_options) + seedrng_with_options eend $? "Error seeding random number generator" return 0 } @@ -38,7 +38,7 @@ start() stop() { ebegin "Saving random number generator seed" - seedrng $(seedrng_options) + seedrng_with_options eend $? "Error saving random number generator seed" return 0 } |