summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-03-31 11:22:07 +0200
committerLennart Poettering <lennart@poettering.net>2022-03-31 11:44:46 +0200
commite2bc5194af65cb8311d4572ab14367ddf42996d9 (patch)
tree70435b9cb199d1ce0b05961fc40e7cd237b575b3 /src
parentintegritysetup: also port to mangle_none() (diff)
downloadsystemd-e2bc5194af65cb8311d4572ab14367ddf42996d9.tar.xz
systemd-e2bc5194af65cb8311d4572ab14367ddf42996d9.zip
integritysetup: also validate volume name
Exactly like for veritysetup/cryptsetup
Diffstat (limited to 'src')
-rw-r--r--src/integritysetup/integritysetup.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/integritysetup/integritysetup.c b/src/integritysetup/integritysetup.c
index f95840a8d0..924c15b6eb 100644
--- a/src/integritysetup/integritysetup.c
+++ b/src/integritysetup/integritysetup.c
@@ -124,6 +124,9 @@ static int run(int argc, char *argv[]) {
key_file = mangle_none(argc > 4 ? argv[4] : NULL);
options = mangle_none(argc > 5 ? argv[5] : NULL);
+ if (!filename_is_valid(volume))
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Volume name '%s' is not valid.", volume);
+
if (key_file) {
r = load_key_file(key_file, &key_buf, &key_buf_size);
if (r < 0)
@@ -174,6 +177,9 @@ static int run(int argc, char *argv[]) {
if (argc > 3)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "detach has a maximum of two arguments.");
+ if (!filename_is_valid(volume))
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Volume name '%s' is not valid.", volume);
+
r = crypt_init_by_name(&cd, volume);
if (r == -ENODEV) {
log_info("Volume %s already inactive.", volume);