1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2026-06-17 01:56:10 -05:00

Honor --no-size-check when creating file containers via the CLI

The text-mode volume creation path clamps the maximum allowed volume
size to the available free disk space and never consults
ArgDisableFileSizeCheck, so the documented --no-size-check switch has no
effect when creating a file-hosted container with `--text --create`.

The flag is honored by the GUI wizard (Forms/VolumeSizeWizardPage.cpp)
but was missing from the text UI, making it impossible to create a
(sparse) container larger than the current free space from the command
line -- even though such a container is perfectly valid on filesystems
with sparse-file support (e.g. APFS, ext4, NTFS) and is exactly what the
flag exists to allow.

Skip the free-space clamp when --no-size-check is set, mirroring the GUI
behavior.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Damian Rickard
2026-06-10 16:37:32 -04:00
parent d26216c294
commit 2dbc718225
+4 -1
View File
@@ -766,7 +766,10 @@ namespace VeraCrypt
if (options->Type == VolumeType::Normal && wxDirExists(parentDir) && wxGetDiskSpace (parentDir, nullptr, &diskSpace))
{
AvailableDiskSpace = (uint64) diskSpace.GetValue ();
if (maxVolumeSize > AvailableDiskSpace)
// Honor --no-size-check so a (sparse) file container larger than the
// current free space can be created from the command line, mirroring
// the GUI wizard behavior (see VolumeSizeWizardPage.cpp).
if (maxVolumeSize > AvailableDiskSpace && !CmdLine->ArgDisableFileSizeCheck)
maxVolumeSize = AvailableDiskSpace;
}
}