- 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);
HeapFree(GetProcessHeap(), 0, pszResultStr);
}
/* Replace standard negative sign to setted */ /* Replace standard negative sign to setted */
pszResultStr = ReplaceSubStr(szNewSample, pszString2 = ReplaceSubStr(pszString1,
pGlobalData->szNumNegativeSign, pGlobalData->szNumNegativeSign,
L"-"); L"-");
if (pszResultStr != NULL) if (pszString2 != NULL)
{ {
SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNNUMFORMAT, SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNNUMFORMAT,
CB_ADDSTRING, CB_ADDSTRING,
0, 0,
(LPARAM)pszResultStr); (LPARAM)pszString2);
HeapFree(GetProcessHeap(), 0, pszResultStr);
HeapFree(GetProcessHeap(), 0, pszString2);
}
HeapFree(GetProcessHeap(), 0, pszString1);
} }
} }