From e2bc5194af65cb8311d4572ab14367ddf42996d9 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 31 Mar 2022 11:22:07 +0200 Subject: integritysetup: also validate volume name Exactly like for veritysetup/cryptsetup --- src/integritysetup/integritysetup.c | 6 ++++++ 1 file changed, 6 insertions(+) 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); -- cgit v1.2.3