From 2dbc71822508c877d1c39efc782907de1fce51e6 Mon Sep 17 00:00:00 2001 From: Damian Rickard Date: Wed, 10 Jun 2026 16:37:32 -0400 Subject: [PATCH 1/2] 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 --- src/Main/TextUserInterface.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp index f8e2b1b283..46ad89540e 100644 --- a/src/Main/TextUserInterface.cpp +++ b/src/Main/TextUserInterface.cpp @@ -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; } } From 177ec1fce1ad83697f2660bc2b22f70ea639cf95 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sun, 14 Jun 2026 23:13:24 +0900 Subject: [PATCH 2/2] Fix max volume size handling with no-size-check Keep the max size sentinel and interactive max choice bounded by available disk space even when --no-size-check allows explicit sparse container sizes beyond the current free space. --- src/Main/TextUserInterface.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp index 46ad89540e..e99c847443 100644 --- a/src/Main/TextUserInterface.cpp +++ b/src/Main/TextUserInterface.cpp @@ -782,8 +782,8 @@ namespace VeraCrypt else if (AvailableDiskSpace) { // caller requesting maximum size - // we use maxVolumeSize because it is guaranteed to be less or equal to AvailableDiskSpace for outer volumes - options->Size = maxVolumeSize; + // Limit "max" to available disk space even when --no-size-check allows explicit sparse sizes beyond it. + options->Size = VC_MIN (maxVolumeSize, AvailableDiskSpace); } else { @@ -811,8 +811,8 @@ namespace VeraCrypt else if (AvailableDiskSpace) { // caller requesting maximum size - // we use maxVolumeSize because it is guaranteed to be less or equal to AvailableDiskSpace for outer volumes - options->Size = maxVolumeSize; + // Limit "max" to available disk space even when --no-size-check allows explicit sparse sizes beyond it. + options->Size = VC_MIN (maxVolumeSize, AvailableDiskSpace); } else {