From 3c87c095c31552cc19e68c2c2678453f36476f81 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Tue, 16 Feb 2016 22:59:21 +0100 Subject: Windows: use buffer with known maximum length as input to FakeDosNameForDevice --- src/Format/InPlace.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Format/InPlace.c b/src/Format/InPlace.c index a6b6abeb..720b9466 100644 --- a/src/Format/InPlace.c +++ b/src/Format/InPlace.c @@ -779,9 +779,9 @@ int EncryptPartitionInPlaceResume (HANDLE dev, if (dev == INVALID_HANDLE_VALUE) { - StringCbCopyW (deviceName, sizeof(deviceName), devicePath); + StringCchCopyW (deviceName, ARRAYSIZE(deviceName), devicePath); - if (FakeDosNameForDevice (devicePath, dosDev, sizeof(dosDev),devName, sizeof(devName),FALSE) != 0) + if (FakeDosNameForDevice (deviceName, dosDev, sizeof(dosDev),devName, sizeof(devName),FALSE) != 0) { nStatus = ERR_OS_ERROR; goto closing_seq; @@ -1244,9 +1244,9 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile } - StringCbCopyW (deviceName, sizeof(deviceName), devicePath); + StringCchCopyW (deviceName, ARRAYSIZE(deviceName), devicePath); - if (FakeDosNameForDevice (devicePath, dosDev, sizeof(dosDev), devName, sizeof(devName), FALSE) != 0) + if (FakeDosNameForDevice (deviceName, dosDev, sizeof(dosDev), devName, sizeof(devName), FALSE) != 0) { nStatus = ERR_OS_ERROR; goto closing_seq; -- cgit v1.2.3