1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 11:08:02 -06:00

Linux: Fix wrong max size for hidden volume in CLI direct mode creation

There was a logical bug that made the code check the filesystem size of
the device path "/dev" instead of using the actual size of the device

Fix #1180
This commit is contained in:
Mounir IDRASSI
2023-08-19 20:44:32 +02:00
parent ed70b673d5
commit 9d8afdad93

View File

@@ -656,17 +656,24 @@ namespace VeraCrypt
else else
{ {
uint64 AvailableDiskSpace = 0; uint64 AvailableDiskSpace = 0;
wxLongLong diskSpace = 0; if (options->Path.IsDevice())
wxString parentDir = wxFileName (wstring (options->Path)).GetPath();
if (parentDir.IsEmpty())
{ {
parentDir = wxT("."); AvailableDiskSpace = maxVolumeSize;
} }
if (wxDirExists(parentDir) && wxGetDiskSpace (parentDir, nullptr, &diskSpace)) else
{ {
AvailableDiskSpace = (uint64) diskSpace.GetValue (); wxLongLong diskSpace = 0;
if (maxVolumeSize > AvailableDiskSpace) wxString parentDir = wxFileName (wstring (options->Path)).GetPath();
maxVolumeSize = AvailableDiskSpace; if (parentDir.IsEmpty())
{
parentDir = wxT(".");
}
if (wxDirExists(parentDir) && wxGetDiskSpace (parentDir, nullptr, &diskSpace))
{
AvailableDiskSpace = (uint64) diskSpace.GetValue ();
if (maxVolumeSize > AvailableDiskSpace)
maxVolumeSize = AvailableDiskSpace;
}
} }
if (options->Size == (uint64) (-1)) if (options->Size == (uint64) (-1))