]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
efi-loader: make efi_loader_entry_name_valid() check a bit stricter
authorLennart Poettering <lennart@poettering.net>
Mon, 8 Mar 2021 21:27:05 +0000 (22:27 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 8 Mar 2021 21:47:41 +0000 (22:47 +0100)
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

index 2aab39c32d500ce16ec0e1c766c3fc5d66055380..ee32b0b097f153829c5441785a52f50bc81c2fa7 100644 (file)
@@ -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 "+-_.");