- Fix a potential overflow and uninitialized variable in InitNegNumFmtCB().
- Get rid of the now useless string buffer szNewSample.
Based on a patch by Victor Martinez Calvo.
CORE-13384

svn path=/trunk/; revision=74942
This commit is contained in:
Eric Kohl 2017-06-07 15:55:16 +00:00
parent fd32dd8623
commit 3e87295366

View file

@ -267,8 +267,7 @@ InitNegSignCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
static VOID static VOID
InitNegNumFmtCB(HWND hwndDlg, PGLOBALDATA pGlobalData) InitNegNumFmtCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
{ {
WCHAR szNewSample[MAX_SAMPLES_STR_SIZE]; PWSTR pszString1, pszString2;
PWSTR pszResultStr;
INT nCBIndex; INT nCBIndex;
/* Clear all box content */ /* Clear all box content */
@ -281,26 +280,26 @@ InitNegNumFmtCB(HWND hwndDlg, PGLOBALDATA pGlobalData)
for (nCBIndex = 0; nCBIndex < MAX_NEG_NUMBERS_SAMPLES; nCBIndex++) for (nCBIndex = 0; nCBIndex < MAX_NEG_NUMBERS_SAMPLES; nCBIndex++)
{ {
/* Replace standard separator to setted */ /* Replace standard separator to setted */
pszResultStr = ReplaceSubStr(lpNegNumFmtSamples[nCBIndex], pszString1 = ReplaceSubStr(lpNegNumFmtSamples[nCBIndex],
pGlobalData->szNumDecimalSep, pGlobalData->szNumDecimalSep,
L","); L",");
if (pszResultStr != NULL) if (pszString1 != NULL)
{ {
wcscpy(szNewSample, pszResultStr); /* Replace standard negative sign to setted */
HeapFree(GetProcessHeap(), 0, pszResultStr); pszString2 = ReplaceSubStr(pszString1,
} pGlobalData->szNumNegativeSign,
L"-");
if (pszString2 != NULL)
{
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNNUMFORMAT,
CB_ADDSTRING,
0,
(LPARAM)pszString2);
/* Replace standard negative sign to setted */ HeapFree(GetProcessHeap(), 0, pszString2);
pszResultStr = ReplaceSubStr(szNewSample, }
pGlobalData->szNumNegativeSign,
L"-"); HeapFree(GetProcessHeap(), 0, pszString1);
if (pszResultStr != NULL)
{
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNNUMFORMAT,
CB_ADDSTRING,
0,
(LPARAM)pszResultStr);
HeapFree(GetProcessHeap(), 0, pszResultStr);
} }
} }