diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2019-10-02 22:28:22 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2019-10-02 22:31:28 +0200 |
commit | 400bb5224700e7dcaa2eb3572a3ba2a3fbdf02e1 (patch) | |
tree | bd80e6db93da09cb9199324fc4b88a85b17d85ce /src/Main/Forms | |
parent | f16a298d9f4ab0f78f2af0d977be23d4236093d6 (diff) | |
download | VeraCrypt-400bb5224700e7dcaa2eb3572a3ba2a3fbdf02e1.tar.gz VeraCrypt-400bb5224700e7dcaa2eb3572a3ba2a3fbdf02e1.zip |
Linux/MacOSX:check that the requested size of file container is less than available
disk free space. Add a CLI switch to disable this check.
Diffstat (limited to 'src/Main/Forms')
-rw-r--r-- | src/Main/Forms/VolumeSizeWizardPage.cpp | 10 | ||||
-rw-r--r-- | src/Main/Forms/VolumeSizeWizardPage.h | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/Main/Forms/VolumeSizeWizardPage.cpp b/src/Main/Forms/VolumeSizeWizardPage.cpp index f4044418..3781b05d 100644 --- a/src/Main/Forms/VolumeSizeWizardPage.cpp +++ b/src/Main/Forms/VolumeSizeWizardPage.cpp @@ -21,7 +21,8 @@ namespace VeraCrypt MaxVolumeSize (0), MaxVolumeSizeValid (false), MinVolumeSize (1), - SectorSize (sectorSize) + SectorSize (sectorSize), + AvailableDiskSpace (0) { VolumeSizePrefixChoice->Append (LangString["KB"], reinterpret_cast <void *> (1024)); VolumeSizePrefixChoice->Append (LangString["MB"], reinterpret_cast <void *> (1024 * 1024)); @@ -34,6 +35,10 @@ namespace VeraCrypt VolumeSizeTextCtrl->Disable(); VolumeSizeTextCtrl->SetValue (L""); } + else + { + AvailableDiskSpace = (uint64) diskSpace.GetValue (); + } FreeSpaceStaticText->SetFont (Gui->GetDefaultBoldFont (this)); @@ -97,7 +102,8 @@ namespace VeraCrypt { try { - if (GetVolumeSize() >= MinVolumeSize && (!MaxVolumeSizeValid || GetVolumeSize() <= MaxVolumeSize)) + uint64 uiVolumeSize = GetVolumeSize(); + if (uiVolumeSize >= MinVolumeSize && (!MaxVolumeSizeValid || uiVolumeSize <= MaxVolumeSize) && (CmdLine->ArgDisableFileSizeCheck || !AvailableDiskSpace || uiVolumeSize <= AvailableDiskSpace)) return true; } catch (...) { } diff --git a/src/Main/Forms/VolumeSizeWizardPage.h b/src/Main/Forms/VolumeSizeWizardPage.h index e12a5a79..aac41f99 100644 --- a/src/Main/Forms/VolumeSizeWizardPage.h +++ b/src/Main/Forms/VolumeSizeWizardPage.h @@ -49,6 +49,7 @@ namespace VeraCrypt bool MaxVolumeSizeValid; uint64 MinVolumeSize; uint32 SectorSize; + uint64 AvailableDiskSpace; }; } |