[USETUP]: Fix the primary/extended partitions creation checks introduced in r63392 : indeed this is if there are *already* 4 (primary) partitions in the table that we cannot create new primary/extended partitions.

Otherwise with the old (broken) checks, we allowed creating more than 4 partitions, and then we overflowed over memory and corrupted the partition list structures.

svn path=/trunk/; revision=74516
This commit is contained in:
Hermès Bélusca-Maïto 2017-05-09 22:09:06 +00:00
parent af645ee7a2
commit 3acad0e9e5

View file

@ -3550,8 +3550,8 @@ PrimaryPartitionCreationChecks(
if (PartEntry->IsPartitioned == TRUE)
return ERROR_NEW_PARTITION;
/* Fail if there are more than 4 partitions in the list */
if (GetPrimaryPartitionCount(DiskEntry) > 4)
/* Fail if there are already 4 primary partitions in the list */
if (GetPrimaryPartitionCount(DiskEntry) >= 4)
return ERROR_PARTITION_TABLE_FULL;
return ERROR_SUCCESS;
@ -3572,8 +3572,8 @@ ExtendedPartitionCreationChecks(
if (PartEntry->IsPartitioned == TRUE)
return ERROR_NEW_PARTITION;
/* Fail if there are more than 4 partitions in the list */
if (GetPrimaryPartitionCount(DiskEntry) > 4)
/* Fail if there are already 4 primary partitions in the list */
if (GetPrimaryPartitionCount(DiskEntry) >= 4)
return ERROR_PARTITION_TABLE_FULL;
/* Fail if there is another extended partition in the list */