diff options
Diffstat (limited to 'src/dutil/reswutil.cpp')
| -rw-r--r-- | src/dutil/reswutil.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
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( | |||
| 288 | { | 288 | { |
| 289 | HRESULT hr = S_OK; | 289 | HRESULT hr = S_OK; |
| 290 | LPWSTR pwzData = NULL; | 290 | LPWSTR pwzData = NULL; |
| 291 | DWORD cchData = lstrlenW(szData); | 291 | size_t cchData = 0; |
| 292 | |||
| 293 | hr = ::StringCchLengthW(szData, STRSAFE_MAX_LENGTH, &cchData); | ||
| 294 | ReswExitOnRootFailure(hr, "Failed to get block string length."); | ||
| 292 | 295 | ||
| 293 | pwzData = static_cast<LPWSTR>(MemAlloc((cchData + 1) * sizeof(WCHAR), TRUE)); | 296 | pwzData = static_cast<LPWSTR>(MemAlloc((cchData + 1) * sizeof(WCHAR), TRUE)); |
| 294 | ReswExitOnNull(pwzData, hr, E_OUTOFMEMORY, "Failed to allocate new block string."); | 297 | ReswExitOnNull(pwzData, hr, E_OUTOFMEMORY, "Failed to allocate new block string."); |
| 295 | 298 | ||
| 296 | hr = ::StringCchCopyW(pwzData, cchData + 1, szData); | 299 | hr = ::StringCchCopyW(pwzData, cchData + 1, szData); |
| 297 | ReswExitOnFailure(hr, "Failed to copy new block string."); | 300 | ReswExitOnRootFailure(hr, "Failed to copy new block string."); |
| 298 | 301 | ||
| 299 | ReleaseNullMem(pStrBlock->rgwz[dwStringId]); | 302 | ReleaseNullMem(pStrBlock->rgwz[dwStringId]); |
| 300 | 303 | ||
