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 <eric.snowberg@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Eric Snowberg 2019-03-28 15:26:36 -06:00 committed by Daniel Kiper
parent 3c65959673
commit 4fff586386

View file

@ -162,6 +162,9 @@ is_child (struct grub_efidisk_data *child,
return 0; return 0;
ldp = grub_efi_find_last_device_path (dp); ldp = grub_efi_find_last_device_path (dp);
if (! ldp)
return 0;
ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE; ldp->type = GRUB_EFI_END_DEVICE_PATH_TYPE;
ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE; ldp->subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
ldp->length = sizeof (*ldp); ldp->length = sizeof (*ldp);