From bcd3ee7ab858d62beb36af9f5986544b68a3dd35 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Wed, 28 Apr 2021 16:36:56 -0500 Subject: Clean up more 32-bit assumptions. --- src/dutil/reswutil.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/dutil/reswutil.cpp') diff --git a/src/dutil/reswutil.cpp b/src/dutil/reswutil.cpp index 42b49c55..e78de84a 100644 --- a/src/dutil/reswutil.cpp +++ b/src/dutil/reswutil.cpp @@ -288,13 +288,16 @@ static HRESULT StringBlockChangeString( { HRESULT hr = S_OK; LPWSTR pwzData = NULL; - DWORD cchData = lstrlenW(szData); + size_t cchData = 0; + + hr = ::StringCchLengthW(szData, STRSAFE_MAX_LENGTH, &cchData); + ReswExitOnRootFailure(hr, "Failed to get block string length."); pwzData = static_cast(MemAlloc((cchData + 1) * sizeof(WCHAR), TRUE)); ReswExitOnNull(pwzData, hr, E_OUTOFMEMORY, "Failed to allocate new block string."); hr = ::StringCchCopyW(pwzData, cchData + 1, szData); - ReswExitOnFailure(hr, "Failed to copy new block string."); + ReswExitOnRootFailure(hr, "Failed to copy new block string."); ReleaseNullMem(pStrBlock->rgwz[dwStringId]); -- cgit v1.2.3-55-g6feb