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.
#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 "+-_.");