VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2023-08-19 20:44:32 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2023-08-19 20:44:32 +0200
commit9d8afdad9342c3e06e796c6b02eadb7f12cb6611 (patch)
tree7b09e18600eead9af5ca0df7bdd664cdc4f2c200
parented70b673d53c6fbe9aadc97ca57630ce8d5e9453 (diff)
downloadVeraCrypt-9d8afdad9342c3e06e796c6b02eadb7f12cb6611.tar.gz
VeraCrypt-9d8afdad9342c3e06e796c6b02eadb7f12cb6611.zip
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
-rw-r--r--src/Main/TextUserInterface.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp
index 637d5caa..7b79478f 100644
--- a/src/Main/TextUserInterface.cpp
+++ b/src/Main/TextUserInterface.cpp
@@ -656,17 +656,24 @@ namespace VeraCrypt
else
{
uint64 AvailableDiskSpace = 0;
- wxLongLong diskSpace = 0;
- wxString parentDir = wxFileName (wstring (options->Path)).GetPath();
- if (parentDir.IsEmpty())
+ if (options->Path.IsDevice())
{
- parentDir = wxT(".");
+ AvailableDiskSpace = maxVolumeSize;
}
- if (wxDirExists(parentDir) && wxGetDiskSpace (parentDir, nullptr, &diskSpace))
+ else
{
- AvailableDiskSpace = (uint64) diskSpace.GetValue ();
- if (maxVolumeSize > AvailableDiskSpace)
- maxVolumeSize = AvailableDiskSpace;
+ wxLongLong diskSpace = 0;
+ wxString parentDir = wxFileName (wstring (options->Path)).GetPath();
+ 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))