VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Format.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/Common/Format.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/Common/Format.c')
-rw-r--r--src/Common/Format.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Common/Format.c b/src/Common/Format.c
index a3200bb4..fe12c041 100644
--- a/src/Common/Format.c
+++ b/src/Common/Format.c
@@ -138,7 +138,7 @@ int TCFormatVolume (volatile FORMAT_VOL_PARAMETERS *volParams)
if (volParams->bDevice)
{
- StringCbCopyW (deviceName, sizeof(deviceName), volParams->volumePath);
+ StringCchCopyW (deviceName, ARRAYSIZE(deviceName), volParams->volumePath);
driveLetter = GetDiskDeviceDriveLetter (deviceName);
}
@@ -874,10 +874,10 @@ BOOL FormatFs (int driveNo, int clusterSize, int fsType)
switch (fsType)
{
case FILESYS_NTFS:
- StringCbCopyW (szFsFormat, sizeof (szFsFormat),L"NTFS");
+ StringCchCopyW (szFsFormat, ARRAYSIZE (szFsFormat),L"NTFS");
break;
case FILESYS_EXFAT:
- StringCbCopyW (szFsFormat, sizeof (szFsFormat),L"EXFAT");
+ StringCchCopyW (szFsFormat, ARRAYSIZE (szFsFormat),L"EXFAT");
break;
default:
return FALSE;
@@ -886,10 +886,10 @@ BOOL FormatFs (int driveNo, int clusterSize, int fsType)
if (GetSystemDirectory (dllPath, MAX_PATH))
{
- StringCbCatW(dllPath, sizeof(dllPath), L"\\fmifs.dll");
+ StringCchCatW(dllPath, ARRAYSIZE(dllPath), L"\\fmifs.dll");
}
else
- StringCbCopyW(dllPath, sizeof(dllPath), L"C:\\Windows\\System32\\fmifs.dll");
+ StringCchCopyW(dllPath, ARRAYSIZE(dllPath), L"C:\\Windows\\System32\\fmifs.dll");
hModule = LoadLibrary (dllPath);
@@ -902,7 +902,7 @@ BOOL FormatFs (int driveNo, int clusterSize, int fsType)
return FALSE;
}
- StringCbCatW (dir, sizeof(dir), L":\\");
+ StringCchCatW (dir, ARRAYSIZE(dir), L":\\");
FormatExError = TRUE;