From 3acad0e9e5117a320765711dcac9923bd1a34dd0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Tue, 9 May 2017 22:09:06 +0000 Subject: [PATCH] [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 --- reactos/base/setup/usetup/partlist.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/reactos/base/setup/usetup/partlist.c b/reactos/base/setup/usetup/partlist.c index 738bd732bd9..300e07e019e 100644 --- a/reactos/base/setup/usetup/partlist.c +++ b/reactos/base/setup/usetup/partlist.c @@ -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 */ -- 2.17.1