From 4fff586386c54773e518e7f51eab19e6265a056d Mon Sep 17 00:00:00 2001 From: Eric Snowberg Date: Thu, 28 Mar 2019 15:26:36 -0600 Subject: [PATCH] efidisk: NULL pointer dereference in is_child() Function grub_efi_find_last_device() path may return NULL when called from is_child(). Signed-off-by: Eric Snowberg Reviewed-by: Daniel Kiper --- grub-core/disk/efi/efidisk.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c index 961c1552b..78ab2d21a 100644 --- a/grub-core/disk/efi/efidisk.c +++ b/grub-core/disk/efi/efidisk.c @@ -162,6 +162,9 @@ is_child (struct grub_efidisk_data *child, return 0; ldp = grub_efi_find_last_device_path (dp); + if (! ldp) + return 0; + ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; ldp->length = sizeof (*ldp);