boot/efi/stub.c: fix Dell LoadOptions
authorHarald Hoyer <harald@redhat.com>
Mon, 3 Sep 2018 11:57:54 +0000 (13:57 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 3 Sep 2018 12:10:38 +0000 (14:10 +0200)
On Dell machines LoadOptions is filled with:
01 00 00 00 <name of BIOS Boot Loader Entry> ... <unknown bytes>

So, in case of meaningfull LoadOptions, better check if the first char
is a printable character.

src/boot/efi/stub.c

index 15cdfca..5c97b54 100644 (file)
@@ -68,7 +68,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
         cmdline_len = szs[0];
 
         /* if we are not in secure boot mode, accept a custom command line and replace the built-in one */
-        if (!secure && loaded_image->LoadOptionsSize > 0 && *(CHAR16 *)loaded_image->LoadOptions != 0) {
+        if (!secure && loaded_image->LoadOptionsSize > 0 && *(CHAR16 *)loaded_image->LoadOptions > 0x1F) {
                 CHAR16 *options;
                 CHAR8 *line;
                 UINTN i;