mirror of
https://git.proxmox.com/git/efi-boot-shim
synced 2025-08-03 08:26:21 +00:00
shim: if generate_path() gets a full path, just return it.
We decide if it's a full path by if it starts with \\EFI\\. That's quite lazy, but we can't just check \\ like you'd hope, because we need to stay compatible with what we've set as DEFAULT_LOADER in the past, and I don't feel like writing the full path traversal file test. Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
parent
b0d44f447d
commit
6d5258995a
18
shim.c
18
shim.c
@ -1347,6 +1347,24 @@ static EFI_STATUS generate_path(EFI_LOADED_IMAGE *li, CHAR16 *ImagePath,
|
||||
EFI_STATUS efi_status = EFI_SUCCESS;
|
||||
CHAR16 *bootpath;
|
||||
|
||||
/*
|
||||
* Suuuuper lazy technique here, but check and see if this is a full
|
||||
* path to something on the ESP. Backwards compatibility demands
|
||||
* that we don't just use \\, becuase we (not particularly brightly)
|
||||
* used to require that the relative file path started with that.
|
||||
*
|
||||
* If it is a full path, don't try to merge it with the directory
|
||||
* from our Loaded Image handle.
|
||||
*/
|
||||
if (StrSize(ImagePath) > 5 && StrnCmp(ImagePath, L"\\EFI\\", 5) == 0) {
|
||||
*PathName = StrDuplicate(ImagePath);
|
||||
if (!*PathName) {
|
||||
perror(L"Failed to allocate path buffer\n");
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
devpath = li->FilePath;
|
||||
|
||||
bootpath = DevicePathToStr(devpath);
|
||||
|
Loading…
Reference in New Issue
Block a user