summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauri Kenttä <lauri.kentta@gmail.com>2023-12-02 20:27:07 +0200
committerPeter Jones <pjones@redhat.com>2024-12-17 14:35:26 -0500
commit314aecf89318d31697a3fabf14cf49a0dc359331 (patch)
tree6b8b9a71e6d08a7f522bb5ca682d261e069802bf
parentfd7e16f7d0f7edf3f79db7323ed449e9ed053e36 (diff)
downloadefi-boot-shim-314aecf89318d31697a3fabf14cf49a0dc359331.tar.gz
efi-boot-shim-314aecf89318d31697a3fabf14cf49a0dc359331.zip
Discard load-options that start with WINDOWS
Windows bcdedit.exe creates boot entries where load options begin with "WINDOWS\0" (in 8-bit chars), followed by some Windows-specific data which is useless for shim. This data causes shim error "Failed to open \EFI\mypath\䥗䑎坏S". Resolves: #370 Signed-off-by: Lauri Kenttä <lauri.kentta@gmail.com>
-rw-r--r--load-options.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/load-options.c b/load-options.c
index 8b92e37f..84fcfb7e 100644
--- a/load-options.c
+++ b/load-options.c
@@ -442,6 +442,14 @@ parse_load_options(EFI_LOADED_IMAGE *li)
}
}
+ /*
+ * Windows bcdedit.exe puts "WINDOWS\0" (in 8-bit) in the beginning of
+ * the options, so if we see that, we know it's not useful to us.
+ */
+ if (li->LoadOptionsSize >= 8)
+ if (CompareMem(li->LoadOptions, "WINDOWS", 8) == 0)
+ return EFI_SUCCESS;
+
loader_str = split_load_options(li->LoadOptions, li->LoadOptionsSize,
&remaining, &remaining_size);