efidisk: Write to NULL pointer ldp

Function grub_efi_find_last_device_path() may return constant NULL when
called from find_parent_device().

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 14:32:31 -06:00 committed by Vincent Batts
parent 77ba219376
commit 3d8f6ea345

View file

@ -129,6 +129,9 @@ find_parent_device (struct grub_efidisk_data *devices,
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);