From: Lennart Poettering Date: Fri, 5 Jul 2024 14:17:27 +0000 (+0200) Subject: bootspec: automatically filter non-native UKIs and add-ons when enumerating X-Git-Tag: v257-rc1~441^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F34347%2Fhead;p=thirdparty%2Fsystemd.git bootspec: automatically filter non-native UKIs and add-ons when enumerating --- diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c index a74204f1191..50a07400fe3 100644 --- a/src/shared/bootspec.c +++ b/src/shared/bootspec.c @@ -930,6 +930,9 @@ static int pe_find_uki_sections( if (!pe_is_uki(pe_header, sections)) return log_error_errno(SYNTHETIC_ERRNO(EBADMSG), "Parsed PE file '%s' is not a UKI.", path); + if (!pe_is_native(pe_header)) /* Don't process non-native UKIs */ + goto nothing; + /* Find part of the section table for this profile */ size_t n_psections = 0; const IMAGE_SECTION_HEADER *psections = pe_find_profile_section_table(pe_header, sections, profile, &n_psections); @@ -1004,9 +1007,12 @@ static int pe_find_addon_sections( if (!pe_is_addon(pe_header, sections)) return log_error_errno(SYNTHETIC_ERRNO(EBADMSG), "Parse PE file '%s' is not an add-on.", path); - /* Define early, before the goto below */ + /* Define early, before the gotos below */ _cleanup_free_ char *cmdline_text = NULL; + if (!pe_is_native(pe_header)) + goto nothing; + const IMAGE_SECTION_HEADER *found = pe_section_table_find(sections, le16toh(pe_header->pe.NumberOfSections), ".cmdline"); if (!found) goto nothing;