From f470d234d3c5af97e846307b15dc6b298c75380b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 8 Mar 2021 22:27:05 +0100 Subject: [PATCH] efi-loader: make efi_loader_entry_name_valid() check a bit stricter Previously we'd just check if the ID was no-empty an no longer than FILENAME_MAX. The latter was probably a mistake, given the comment next to it. Instead of fixing that to check for NAME_MAX let's instead just switch over to filename_is_valid() which odes a similar check, plus a some minor additional checks. After all we do want that valid EFI boot menu entry ids are usable as filenames. --- src/shared/efi-loader.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/shared/efi-loader.c b/src/shared/efi-loader.c index 2aab39c32d5..ee32b0b097f 100644 --- a/src/shared/efi-loader.c +++ b/src/shared/efi-loader.c @@ -809,10 +809,8 @@ bool efi_has_tpm2(void) { #endif bool efi_loader_entry_name_valid(const char *s) { - if (isempty(s)) - return false; - if (strlen(s) > FILENAME_MAX) /* Make sure entry names fit in filenames */ + if (!filename_is_valid(s)) /* Make sure entry names fit in filenames */ return false; return in_charset(s, ALPHANUMERICAL "+-_."); -- 2.47.3