summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-03-04 19:19:30 +0100
committerLennart Poettering <lennart@poettering.net>2019-03-05 16:50:58 +0100
commiteed7210a5c13299364cddf3600c2e76d4889ab36 (patch)
tree5fcd8b66845c19e9bb5f523fcee0fe526a7c3880 /src/shared
parent38bd74d67e5d2f2c12b1135ff6872544fe944a3f (diff)
downloadsystemd-eed7210a5c13299364cddf3600c2e76d4889ab36.tar.gz
bootspec: validate bootpsec entry ids before we use them
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/bootspec.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c
index 03f8629735..39a7a97b12 100644
--- a/src/shared/bootspec.c
+++ b/src/shared/bootspec.c
@@ -66,13 +66,16 @@ static int boot_entry_load(
c = endswith_no_case(path, ".conf");
if (!c)
- return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Invalid loader entry filename: %s", path);
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Invalid loader entry file suffix: %s", path);
b = basename(path);
tmp.id = strndup(b, c - b);
if (!tmp.id)
return log_oom();
+ if (!efi_loader_entry_name_valid(tmp.id))
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Invalid loader entry filename: %s", path);
+
tmp.path = strdup(path);
if (!tmp.path)
return log_oom();
@@ -310,6 +313,9 @@ static int boot_entry_load_unified(
if (!tmp.id)
return log_oom();
+ if (!efi_loader_entry_name_valid(tmp.id))
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Invalid loader entry: %s", tmp.id);
+
tmp.path = strdup(path);
if (!tmp.path)
return log_oom();