Explorar o código

part_dos: check status flags of partitions

Only read partitions which have 0x00 or 0x80 set in their status field.
All others are invalid.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Daniel Mack %!s(int64=15) %!d(string=hai) anos
pai
achega
78f4ca7976
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      disk/part_dos.c

+ 2 - 1
disk/part_dos.c

@@ -188,7 +188,8 @@ static int get_partition_info_extended (block_dev_desc_t *dev_desc, int ext_part
 		 * fdisk does not show the extended partitions that
 		 * fdisk does not show the extended partitions that
 		 * are not in the MBR
 		 * are not in the MBR
 		 */
 		 */
-		if ((pt->sys_ind != 0) &&
+		if (((pt->boot_ind & ~0x80) == 0) &&
+		    (pt->sys_ind != 0) &&
 		    (part_num == which_part) &&
 		    (part_num == which_part) &&
 		    (is_extended(pt->sys_ind) == 0)) {
 		    (is_extended(pt->sys_ind) == 0)) {
 			info->blksz = 512;
 			info->blksz = 512;