[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/1] efi: avoid NULL dereference if FilePath is NULL
From: |
Leif Lindholm |
Subject: |
Re: [PATCH 1/1] efi: avoid NULL dereference if FilePath is NULL |
Date: |
Wed, 17 Apr 2019 00:01:17 +0100 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
On Tue, Apr 16, 2019 at 08:01:10PM +0200, Heinrich Schuchardt wrote:
> The UEFI specification allows LoadImage() to be called with a memory
> location only and without a device path. In this case FilePath will not be
> set in the EFI_LOADED_IMAGE_PROTOCOL.
>
> So in function grub_efi_get_filename() the device path argument may be
> NULL. As we cannot determine the device path in this case just return NULL
> from the function.
>
> Signed-off-by: Heinrich Schuchardt <address@hidden>
Reviewed-by: Leif Lindholm <address@hidden>
> ---
> grub-core/kern/efi/efi.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
> index 708581fcb..84e68cf31 100644
> --- a/grub-core/kern/efi/efi.c
> +++ b/grub-core/kern/efi/efi.c
> @@ -327,6 +327,9 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0)
> grub_size_t filesize = 0;
> grub_efi_device_path_t *dp;
>
> + if (!dp0)
> + return NULL;
> +
> dp = dp0;
>
> while (1)
> --
> 2.20.1
>