diff --git a/reactos/drivers/filesystems/ntfs/fsctl.c b/reactos/drivers/filesystems/ntfs/fsctl.c index b956c06ba32..ab53c79a0a4 100644 --- a/reactos/drivers/filesystems/ntfs/fsctl.c +++ b/reactos/drivers/filesystems/ntfs/fsctl.c @@ -45,9 +45,9 @@ NtfsHasFileSystem(PDEVICE_OBJECT DeviceToMount) { PARTITION_INFORMATION PartitionInfo; DISK_GEOMETRY DiskGeometry; + ULONG ClusterSize, Size, k; PBOOT_SECTOR BootSector; NTSTATUS Status; - ULONG Size, k; DPRINT1("NtfsHasFileSystem() called\n"); @@ -91,7 +91,7 @@ NtfsHasFileSystem(PDEVICE_OBJECT DeviceToMount) DPRINT1("BytesPerSector: %lu\n", DiskGeometry.BytesPerSector); BootSector = ExAllocatePoolWithTag(NonPagedPool, - DiskGeometry.BytesPerSector, TAG_NTFS); + DiskGeometry.BytesPerSector, TAG_NTFS); if (BootSector == NULL) { return(STATUS_INSUFFICIENT_RESOURCES); @@ -138,6 +138,17 @@ NtfsHasFileSystem(PDEVICE_OBJECT DeviceToMount) goto ByeBye; } } + /* Check cluster size */ + ClusterSize = BootSector->BPB.BytesPerSector * BootSector->BPB.SectorsPerCluster; + if (ClusterSize != 512 && ClusterSize != 1024 && + ClusterSize != 2048 && ClusterSize != 4096) + { + DPRINT1("Cluster size failed: %hu, %hu, %hu\n", BootSector->BPB.BytesPerSector, + BootSector->BPB.SectorsPerCluster, + ClusterSize); + Status = STATUS_UNRECOGNIZED_VOLUME; + goto ByeBye; + } ByeBye: ExFreePool(BootSector);