Linux/macOS: fix hidden volume FAT size limit

The Unix volume creation wizard applied the FAT32 sector-count limit as a blanket check for device-hosted hidden-volume outer volumes. On 512e disks Linux reports 512-byte logical sectors, so this incorrectly rejected larger device-hosted outer volumes even when the selected outer filesystem was not FAT.

Compute the actual VeraCrypt filesystem/data area size through a shared helper and apply the FAT32 size limit only when FAT is selected. This preserves correct FAT validation while allowing non-FAT outer volumes to proceed to the existing hidden-volume size estimation flow.

Update text-mode creation so FAT is not offered when the selected size cannot support it, and default to the platform native filesystem in that case. Clarify the user-facing FAT limit wording to refer to logical sector size.

Fixes #262
This commit is contained in:
Mounir IDRASSI
2026-05-29 16:42:29 +09:00
parent 610feb4c28
commit 170dfa83ee
46 changed files with 42 additions and 194 deletions
+21 -2
View File
@@ -937,9 +937,14 @@ namespace VeraCrypt
ShowInfo (_("\nFilesystem:"));
vector <VolumeCreationOptions::FilesystemType::Enum> filesystems;
bool fatAvailable = filesystemSize >= TC_MIN_FAT_FS_SIZE
&& filesystemSize <= TC_MAX_FAT_SECTOR_COUNT * (uint64) options->SectorSize;
ShowInfo (wxString::Format (L" %li) %s", filesystems.size() + 1, LangString["NONE"])); filesystems.push_back (VolumeCreationOptions::FilesystemType::None);
ShowInfo (wxString::Format (L" %li) %s", filesystems.size() + 1, "FAT")); filesystems.push_back (VolumeCreationOptions::FilesystemType::FAT);
if (fatAvailable)
{
ShowInfo (wxString::Format (L" %li) %s", filesystems.size() + 1, "FAT")); filesystems.push_back (VolumeCreationOptions::FilesystemType::FAT);
}
#if defined (TC_LINUX)
ShowInfo (wxString::Format (L" %li) %s", filesystems.size() + 1, "Linux Ext2")); filesystems.push_back (VolumeCreationOptions::FilesystemType::Ext2);
ShowInfo (wxString::Format (L" %li) %s", filesystems.size() + 1, "Linux Ext3")); filesystems.push_back (VolumeCreationOptions::FilesystemType::Ext3);
@@ -968,7 +973,21 @@ namespace VeraCrypt
ShowInfo (wxString::Format (L" %li) %s", filesystems.size() + 1, "UFS")); filesystems.push_back (VolumeCreationOptions::FilesystemType::UFS);
#endif
options->Filesystem = filesystems[AskSelection (filesystems.size(), 2) - 1];
ssize_t defaultFilesystem = fatAvailable ? 2 : 1;
if (!fatAvailable)
{
VolumeCreationOptions::FilesystemType::Enum nativeFilesystem = VolumeCreationOptions::FilesystemType::GetPlatformNative();
for (size_t i = 0; i < filesystems.size(); ++i)
{
if (filesystems[i] == nativeFilesystem)
{
defaultFilesystem = (ssize_t) i + 1;
break;
}
}
}
options->Filesystem = filesystems[AskSelection (filesystems.size(), defaultFilesystem) - 1];
}
}