On unknown partition types we end up dereferencing a random pointer. Instead ensure that pointer is NULL and skip it when it's NULL --- sys/arch/i386/stand/efiboot/efidisk.c | 2 +- sys/arch/i386/stand/lib/biosdisk.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/sys/arch/i386/stand/efiboot/efidisk.c b/sys/arch/i386/stand/efiboot/efidisk.c index 57c399aad71..5381ab736ac 100644 --- a/sys/arch/i386/stand/efiboot/efidisk.c +++ b/sys/arch/i386/stand/efiboot/efidisk.c @@ -393,7 +393,7 @@ efidisk_get_efi_system_partition(int dev, int *partition) continue; if (part[i].fstype == FS_UNUSED) continue; - if (guid_is_equal(part[i].guid->guid, &GET_efi)) + if (part[i].guid && guid_is_equal(part[i].guid->guid, &GET_efi)) break; } dealloc_biosdisk_part(part, nparts); diff --git a/sys/arch/i386/stand/lib/biosdisk.c b/sys/arch/i386/stand/lib/biosdisk.c index 02a9dcf0fa1..d8914c1647b 100644 --- a/sys/arch/i386/stand/lib/biosdisk.c +++ b/sys/arch/i386/stand/lib/biosdisk.c @@ -400,6 +400,7 @@ check_gpt(struct biosdisk *d, daddr_t rf_offset, daddr_t sector) entblk = gpth.hdr_lba_table + rf_offset; crc = crc32(0, NULL, 0); + memset(d->part, 0, sizeof(d->part)); j = 0; ep = (const struct gpt_ent *)d->buf; -- 2.48.1