From ae7ec4802a81770ff164e465b8d1fb51624ca093 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sun, 7 Feb 2016 02:07:38 +0100 Subject: Windows:Fix various issues and warnings reported by static code analysis tool Coverity. --- src/Common/Format.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/Common/Format.c') 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; -- cgit v1.2.3