boot: guard missing Windows auto entry

config_add_entry_loader_auto() returns NULL when the Windows loader
is missing. With reboot-for-bitlocker enabled, the caller still
assigned e->call and could dereference NULL.

This can happen when reboot-for-bitlocker is enabled but the ESP does
not contain EFI/Microsoft/Boot/bootmgfw.efi.

Before:
  systemd-boot could dereference NULL while building the menu

Follow-up for: 661615a0af.
This commit is contained in:
dongshengyuan
2026-07-16 01:26:46 +09:00
committed by Yu Watanabe
parent 3121e14658
commit d0d0eea266
+1 -1
View File
@@ -2292,7 +2292,7 @@ static void config_add_entry_windows(Config *config, EFI_HANDLE *device, EFI_FIL
title ?: u"Windows Boot Manager",
u"\\EFI\\Microsoft\\Boot\\bootmgfw.efi");
if (config->reboot_for_bitlocker)
if (e && config->reboot_for_bitlocker)
e->call = call_boot_windows_bitlocker;
#endif
}