VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Mount
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2022-03-26 20:03:19 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2022-03-26 21:15:11 +0100
commit762065917f3ac47c3bdcacdb608d35b36dfb3973 (patch)
tree7863397c35f5e560c28150879307acec6c18b3d2 /src/Mount
parenta0809fe85c2f1bf130c26ff77aea7dac19b6c05f (diff)
downloadVeraCrypt-762065917f3ac47c3bdcacdb608d35b36dfb3973.tar.gz
VeraCrypt-762065917f3ac47c3bdcacdb608d35b36dfb3973.zip
Windows: Add various checks to address Coverity reported issues.
Diffstat (limited to 'src/Mount')
-rw-r--r--src/Mount/Mount.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index a0370861..a5798afc 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -6583,6 +6583,14 @@ static void ShowSystemEncryptionStatus (HWND hwndDlg)
if (GetAsyncKeyState (VK_SHIFT) < 0 && GetAsyncKeyState (VK_CONTROL) < 0)
{
// Ctrl+Shift held (for debugging purposes)
+ int64 encryptedRatio = 0;
+ if (BootEncStatus.DriveEncrypted
+ && (BootEncStatus.ConfiguredEncryptedAreaStart >= 0)
+ && (BootEncStatus.ConfiguredEncryptedAreaEnd >= BootEncStatus.ConfiguredEncryptedAreaStart)
+ )
+ {
+ encryptedRatio = (BootEncStatus.EncryptedAreaEnd + 1 - BootEncStatus.EncryptedAreaStart) * 100I64 / (BootEncStatus.ConfiguredEncryptedAreaEnd + 1 - BootEncStatus.ConfiguredEncryptedAreaStart);
+ }
DebugMsgBox ("Debugging information for system encryption:\n\nDeviceFilterActive: %d\nBootLoaderVersion: %x\nSetupInProgress: %d\nSetupMode: %d\nVolumeHeaderPresent: %d\nDriveMounted: %d\nDriveEncrypted: %d\n"
"HiddenSystem: %d\nHiddenSystemPartitionStart: %I64d\n"
@@ -6600,7 +6608,7 @@ static void ShowSystemEncryptionStatus (HWND hwndDlg)
BootEncStatus.ConfiguredEncryptedAreaEnd,
BootEncStatus.EncryptedAreaStart,
BootEncStatus.EncryptedAreaEnd,
- !BootEncStatus.DriveEncrypted ? 0 : (BootEncStatus.EncryptedAreaEnd + 1 - BootEncStatus.EncryptedAreaStart) * 100I64 / (BootEncStatus.ConfiguredEncryptedAreaEnd + 1 - BootEncStatus.ConfiguredEncryptedAreaStart));
+ encryptedRatio);
}
if (!BootEncStatus.DriveEncrypted && !BootEncStatus.DriveMounted)