VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Format/InPlace.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2016-02-07 02:07:38 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2016-02-07 02:39:43 +0100
commitae7ec4802a81770ff164e465b8d1fb51624ca093 (patch)
tree369c0ddf810ea03ae2d1426a661b54ca5288c34c /src/Format/InPlace.c
parent229bd668f414cac163d12be9a3284b79d95b4ac0 (diff)
downloadVeraCrypt-ae7ec4802a81770ff164e465b8d1fb51624ca093.tar.gz
VeraCrypt-ae7ec4802a81770ff164e465b8d1fb51624ca093.zip
Windows:Fix various issues and warnings reported by static code analysis tool Coverity.
Diffstat (limited to 'src/Format/InPlace.c')
-rw-r--r--src/Format/InPlace.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Format/InPlace.c b/src/Format/InPlace.c
index aa1e83c4..a6b6abeb 100644
--- a/src/Format/InPlace.c
+++ b/src/Format/InPlace.c
@@ -414,7 +414,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol
dataAreaSize = GetVolumeDataAreaSize (volParams->hiddenVol, deviceSize);
- StringCbCopyW (deviceName, sizeof(deviceName), volParams->volumePath);
+ StringCchCopyW (deviceName, ARRAYSIZE(deviceName), volParams->volumePath);
driveLetter = GetDiskDeviceDriveLetter (deviceName);
@@ -1284,6 +1284,16 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile
goto closing_seq;
}
+ if ( (driveGeometry.BytesPerSector == 0)
+ || (driveGeometry.BytesPerSector > TC_MAX_VOLUME_SECTOR_SIZE)
+ || (driveGeometry.BytesPerSector % ENCRYPTION_DATA_UNIT_SIZE != 0)
+ )
+ {
+ Error ("SECTOR_SIZE_UNSUPPORTED", hwndDlg);
+ nStatus = ERR_DONT_REPORT;
+ goto closing_seq;
+ }
+
sectorSize = driveGeometry.BytesPerSector;