From 009ce1be8fa9bf25775ae2b5f4147717ed5811f3 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 22 Dec 2015 12:25:50 +0100 Subject: [PATCH] Bug fix: When reading an ISO filesystem, the presence of system area options flag bit0 (-protective-msdos-label) was not recognized if a partition is appended. --- libisofs/fs_image.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libisofs/fs_image.c b/libisofs/fs_image.c index 2449117..ee68609 100644 --- a/libisofs/fs_image.c +++ b/libisofs/fs_image.c @@ -3967,20 +3967,21 @@ int iso_analyze_mbr(IsoImage *image, IsoDataSource *src, int flag) is_grub2_mbr = 1; } - if (sai->mbr_req_count == 1 && !is_isohybrid) { + if (sai->mbr_req_count >= 1 && !is_isohybrid) { part = sai->mbr_req[0]; if (part->start_block == 1 && part->block_count + 1 == ((uint64_t) sai->image_size) * 4) { /* libisofs protective msdos label for GRUB2 */ is_protective_label = 1; sub_type = 0; - } else if (part->start_block == 0 && + } else if (sai->mbr_req_count == 1 && part->start_block == 0 && part->block_count <= ((uint64_t) sai->image_size) * 4 && part->block_count + 600 >= ((uint64_t) sai->image_size) * 4 && part->type_byte == 0x96) { /* CHRP (possibly without padding) */ sub_type = 1; - } else if (sai->mbr_req[0]->start_block > 0 && + } else if (sai->mbr_req_count == 1 && + sai->mbr_req[0]->start_block > 0 && (sai->mbr_req[0]->start_block % 4) == 0 && (sai->mbr_req[0]->start_block + sai->mbr_req[0]->block_count) / 4 <= sai->image_size &&