mirror of
https://git.openafs.org/openafs.git
synced 2025-01-31 05:27:44 +00:00
DEVEL15-windows-license-smgl2rtf-20090105
LICENSE MIT Ensure that the input string is nul terminated and then instruct WideCharToMultiByte to compute the length itself instead of passing in a value that is very likely to be wrong. (cherry picked from commit e7edfbbf2204641ba08d0ae5e0d085e5f913f2d2)
This commit is contained in:
parent
0ebd363f1a
commit
d97ef4b087
@ -216,8 +216,8 @@ BOOL TranslateFile (LPTSTR psz)
|
||||
DWORD cbSource;
|
||||
if ((cbSource = GetFileSize (hFile, NULL)) != 0)
|
||||
{
|
||||
LPTSTR abSource = (LPTSTR)malloc(cbSource + 1);
|
||||
memset(abSource, 0x00, cbSource + 1);
|
||||
LPTSTR abSource = (LPTSTR)malloc(cbSource + 4);
|
||||
memset(abSource, 0x00, cbSource + 4);
|
||||
|
||||
DWORD dwRead;
|
||||
if (!ReadFile (hFile, abSource, cbSource, &dwRead, NULL) || cbSource != dwRead)
|
||||
@ -232,7 +232,7 @@ BOOL TranslateFile (LPTSTR psz)
|
||||
memset (abTarget, 0x00, cbTarget);
|
||||
|
||||
BOOL fDefault = FALSE;
|
||||
WideCharToMultiByte (g::CodePage, 0, (LPCWSTR)abSource, cbSource, abTarget, cbTarget, TEXT(" "), &fDefault);
|
||||
WideCharToMultiByte (g::CodePage, 0, (LPCWSTR)abSource, -1, abTarget, cbTarget, TEXT(" "), &fDefault);
|
||||
|
||||
rc = FormatFile (psz, abTarget);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user