efi: strip off final NULL from File Path in grub_efi_get_filename
authorAndrei Borzenkov <arvidjaar@gmail.com>
Sat, 25 Feb 2017 05:39:38 +0000 (08:39 +0300)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Sat, 25 Feb 2017 05:39:38 +0000 (08:39 +0300)
commit892dfbe113d08c18e51d7c27eee5094f3da530ec
tree1a6c207f92338670d5067e60fc0b2dbf67801a67
parent951306c5094d2bfb46d5baedfde84a2015c4a3fa
efi: strip off final NULL from File Path in grub_efi_get_filename

UEFI 2.6 9.3.6.4 File Path Media Device Path says that Path Name is
"A NULL-terminated Path string including directory and file names".

Strip final NULL from Path Name in each File Path node when constructing
full path. To be on safe side, strip all of them.

Fixes failure chainloading grub from grub, when loaded grub truncates
image path and does not find its grub.cfg.

https://bugzilla.opensuse.org/show_bug.cgi?id=1026344

This was triggered by commit ce95549cc54b5d6f494608a7c390dba3aab4fba7;
before it we built Path Name without trailing NULL, and apparently all
other bootloaders use single File Path node, thus not exposing this bug.
grub-core/kern/efi/efi.c