diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2022-03-26 20:03:19 +0100 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2022-03-26 21:15:11 +0100 |
commit | 762065917f3ac47c3bdcacdb608d35b36dfb3973 (patch) | |
tree | 7863397c35f5e560c28150879307acec6c18b3d2 /src/Format/Tcformat.c | |
parent | a0809fe85c2f1bf130c26ff77aea7dac19b6c05f (diff) | |
download | VeraCrypt-762065917f3ac47c3bdcacdb608d35b36dfb3973.tar.gz VeraCrypt-762065917f3ac47c3bdcacdb608d35b36dfb3973.zip |
Windows: Add various checks to address Coverity reported issues.
Diffstat (limited to 'src/Format/Tcformat.c')
-rw-r--r-- | src/Format/Tcformat.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c index 477306ea..efd95caf 100644 --- a/src/Format/Tcformat.c +++ b/src/Format/Tcformat.c @@ -9756,11 +9756,18 @@ int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSi // The map will be scanned to determine the size of the uninterrupted block of free // space (provided there is any) whose end is aligned with the end of the volume. // The value will then be used to determine the maximum possible size of the hidden volume. - - return ScanVolClusterBitmap (hwndDlg, - driveNo, - hiddenVolHostSize / *realClusterSize, - pnbrFreeClusters); + if (*realClusterSize > 0) + { + return ScanVolClusterBitmap (hwndDlg, + driveNo, + hiddenVolHostSize / *realClusterSize, + pnbrFreeClusters); + } + else + { + // should never happen + return -1; + } } else if (!wcsncmp (szFileSystemNameBuffer, L"NTFS", 4) || !_wcsnicmp (szFileSystemNameBuffer, L"exFAT", 5)) { |