1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-12 03:18:26 -06:00

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.
This commit is contained in:
Mounir IDRASSI
2019-10-02 22:28:22 +02:00
parent f16a298d9f
commit 400bb52247
4 changed files with 13 additions and 2 deletions

View File

@@ -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 (...) { }

View File

@@ -49,6 +49,7 @@ namespace VeraCrypt
bool MaxVolumeSizeValid;
uint64 MinVolumeSize;
uint32 SectorSize;
uint64 AvailableDiskSpace;
};
}