From: Heinrich Schuchardt Date: Wed, 17 Apr 2019 05:12:56 +0000 (+0200) Subject: efi: Avoid NULL dereference if FilePath is NULL X-Git-Tag: grub-2.04~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bc58fded5074d139ab61aa510fdcbbcefa304c77;p=thirdparty%2Fgrub.git efi: Avoid NULL dereference if FilePath is NULL 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 Reviewed-by: Leif Lindholm Reviewed-by: Daniel Kiper --- 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)