summaryrefslogtreecommitdiff
path: root/lib/console.c
diff options
context:
space:
mode:
authorJonathan Davies <jonathan.davies@nutanix.com>2024-02-22 16:24:01 +0000
committerPeter Jones <pjones@redhat.com>2024-05-08 17:01:58 -0400
commit0287c6b14c77eeb3e3c61996330850d43d937a2b (patch)
tree9d9459a6eb7028104c2948152ace52dc559afb9d /lib/console.c
parent470a8cd1cbe11741c399f7bb33f4f3444bb68d76 (diff)
downloadefi-boot-shim-0287c6b14c77eeb3e3c61996330850d43d937a2b.tar.gz
efi-boot-shim-0287c6b14c77eeb3e3c61996330850d43d937a2b.zip
shim: don't set second_stage to the empty string
When LoadOptions is either L" " or L"shim.efi ", parse_load_options sets second_stage to the empty string. This is unlikely to be what is intended, and typically leads to a non-obvious failure mode. The failure happens because parse_load_options's call to split_load_options (after eating shim's own filename, if present) returns the empty string. Since init_grub typically passes second_stage to start_image, this causes read_image to concatenate the empty string onto the directory name. This means PathName refers to the directory, not the path to a pe image. Then load_image successfully opens a handle on the directory and reads "data" from it. It only eventually fails when handle_image calls read_header which finds that this data isn't in fact a pe header, reporting "Invalid image". This scenario has been seen when shim is loaded via rEFInd 0.11.5, which sets LoadOptions to the name of the shim program followed by a space character. Instead, modify parse_load_options to leave second_stage set to its default value rather than the empty string. Signed-off-by: Jonathan Davies <jonathan.davies@nutanix.com>
Diffstat (limited to 'lib/console.c')
0 files changed, 0 insertions, 0 deletions