diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 02:19:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 02:19:40 +0000 |
commit | 0a0abc373c07a7744adac48891a393e0882fdb6f (patch) | |
tree | 725955c83a4b5835007e94d0f85bb908d42ca897 /src/shared/reboot-util.c | |
parent | Releasing progress-linux version 252.23-1~deb12u1progress7u1. (diff) | |
download | systemd-0a0abc373c07a7744adac48891a393e0882fdb6f.tar.xz systemd-0a0abc373c07a7744adac48891a393e0882fdb6f.zip |
Merging upstream version 252.25.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/shared/reboot-util.c')
-rw-r--r-- | src/shared/reboot-util.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/shared/reboot-util.c b/src/shared/reboot-util.c index 756f9d3..618658a 100644 --- a/src/shared/reboot-util.c +++ b/src/shared/reboot-util.c @@ -11,8 +11,15 @@ #include "reboot-util.h" #include "string-util.h" #include "umask-util.h" +#include "utf8.h" #include "virt.h" +bool reboot_parameter_is_valid(const char *parameter) { + assert(parameter); + + return ascii_is_valid(parameter) && strlen(parameter) <= NAME_MAX; +} + int update_reboot_parameter_and_warn(const char *parameter, bool keep) { int r; @@ -30,6 +37,9 @@ int update_reboot_parameter_and_warn(const char *parameter, bool keep) { return 0; } + if (!reboot_parameter_is_valid(parameter)) + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Invalid reboot parameter '%s'.", parameter); + RUN_WITH_UMASK(0022) { r = write_string_file("/run/systemd/reboot-param", parameter, WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_ATOMIC); |