diff options
| author | Peter Jones <pjones@redhat.com> | 2015-11-17 11:40:01 -0500 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2015-11-17 11:40:01 -0500 |
| commit | 6d5258995a4554b9759142c7eee714d6f0081c60 (patch) | |
| tree | 163a40585b6e2c5dbee9ae7d66904b0a488a057b | |
| parent | b0d44f447dbdde7f9a93c2a3a6dab83fc0769dc0 (diff) | |
| download | efi-boot-shim-6d5258995a4554b9759142c7eee714d6f0081c60.tar.gz efi-boot-shim-6d5258995a4554b9759142c7eee714d6f0081c60.zip | |
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>
| -rw-r--r-- | shim.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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); |
