Author: khornicek
Date: Tue Apr 8 00:14:44 2014
New Revision: 62685
URL:
http://svn.reactos.org/svn/reactos?rev=62685&view=rev
Log:
[INTL]
- fix a leak
- fix a buffer overrun
CID #503741
CID #716119
Modified:
trunk/reactos/dll/cpl/intl/date.c
trunk/reactos/dll/cpl/intl/sort.c
Modified: trunk/reactos/dll/cpl/intl/date.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/date.c?rev=62…
==============================================================================
--- trunk/reactos/dll/cpl/intl/date.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/intl/date.c [iso-8859-1] Tue Apr 8 00:14:44 2014
@@ -57,6 +57,9 @@
pszFoundSep = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR));
+ if(!pszFoundSep)
+ return NULL;
+
_tcscpy(pszFoundSep,STD_DATE_SEP);
while (nDateCompCount < _tcslen(szSourceStr))
@@ -121,8 +124,9 @@
{
TCHAR szShortDateFmt[MAX_SAMPLES_STR_SIZE];
TCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE];
- TCHAR szFindedDateSep[MAX_SAMPLES_STR_SIZE];
+ TCHAR szFoundDateSep[MAX_SAMPLES_STR_SIZE];
LPTSTR pszResultStr;
+ LPTSTR pszFoundSep;
BOOL OpenApostFlg = FALSE;
INT nFmtStrSize;
INT nDateCompCount;
@@ -166,11 +170,16 @@
return FALSE;
}
+ pszFoundSep = FindDateSep(szShortDateFmt);
+
/* Substring replacement of separator */
- _tcscpy(szFindedDateSep, FindDateSep(szShortDateFmt));
- pszResultStr = ReplaceSubStr(szShortDateFmt, szShortDateSep, szFindedDateSep);
+ _tcscpy(szFoundDateSep, pszFoundSep);
+ pszResultStr = ReplaceSubStr(szShortDateFmt, szShortDateSep, szFoundDateSep);
_tcscpy(szShortDateFmt, pszResultStr);
free(pszResultStr);
+
+ if(pszFoundSep)
+ free(pszFoundSep);
/* Save short date format */
SetLocaleInfo(lcid, LOCALE_SSHORTDATE, szShortDateFmt);
Modified: trunk/reactos/dll/cpl/intl/sort.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/sort.c?rev=62…
==============================================================================
--- trunk/reactos/dll/cpl/intl/sort.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/intl/sort.c [iso-8859-1] Tue Apr 8 00:14:44 2014
@@ -134,7 +134,7 @@
/* Select current locale */
/* or should it be System and not user? */
- GetLocaleInfo(lcid, LOCALE_SSORTNAME, lang, sizeof(lang));
+ GetLocaleInfo(lcid, LOCALE_SSORTNAME, lang, sizeof(lang)/sizeof(TCHAR));
SendMessage(hwnd,
CB_SELECTSTRING,