OSDN Git Service

Use secure versions of library functions.
authorKazuhiro Fujieda <fujieda@users.sourceforge.jp>
Wed, 18 May 2011 14:39:32 +0000 (23:39 +0900)
committerKazuhiro Fujieda <fujieda@users.sourceforge.jp>
Sat, 28 May 2011 07:58:03 +0000 (16:58 +0900)
xkeymacs/dotxkeymacs.cpp
xkeymacs/mainfrm.cpp
xkeymacs/profile.cpp
xkeymacsdll/Commands.cpp
xkeymacsdll/Utils.cpp
xkeymacsdll/xkeymacsdll.cpp

index bf4dee3..6fd2680 100644 (file)
@@ -64,24 +64,25 @@ void CDotXkeymacs::LoadMainData(LPCTSTR lpszFileName)
        TCHAR szDir[_MAX_DIR] = {'\0'};\r
 \r
        if (GetModuleFileName(NULL, szModuleFileName, sizeof(szModuleFileName))) {\r
-               _tsplitpath(szModuleFileName, szDrive, szDir, NULL, NULL);\r
+               _tsplitpath_s(szModuleFileName, szDrive, _MAX_DRIVE, szDir, _MAX_DIR, NULL, 0, NULL, 0);\r
        }\r
 \r
        TCHAR szOldPath[MAX_PATH] = {'\0'};     // This path is used by XKeymacs 3.22 and earlier\r
-       _tmakepath(szOldPath, szDrive, szDir, lpszFileName, m_szExt);\r
+       _tmakepath_s(szOldPath, szDrive, szDir, lpszFileName, m_szExt);\r
 \r
        PathAppend(szDir, _T("etc"));\r
        TCHAR szEtc[MAX_PATH] = {'\0'};\r
-       _tmakepath(szEtc, szDrive, szDir, NULL, NULL);\r
+       _tmakepath_s(szEtc, szDrive, szDir, NULL, NULL);\r
        (void)_tmkdir(szEtc);   // make etc directory if needed\r
 \r
        TCHAR szPath[MAX_PATH] = {'\0'};\r
-       _tmakepath(szPath, szDrive, szDir, lpszFileName, m_szExt);\r
+       _tmakepath_s(szPath, szDrive, szDir, lpszFileName, m_szExt);\r
 \r
        if (_trename(szOldPath, szPath)) {                      // try to move old file as backup when rename returns an error because files exist in both directorys\r
                TCHAR szBackupPath[MAX_PATH] = {'\0'};\r
                TCHAR szBackupFlag[_MAX_FNAME] = _T("~");\r
-               _tmakepath(szBackupPath, szDrive, szDir, _tcscat(szBackupFlag, lpszFileName), m_szExt);\r
+               _tcscat_s(szBackupFlag, lpszFileName);\r
+               _tmakepath_s(szBackupPath, szDrive, szDir, szBackupFlag, m_szExt);\r
                (void)_trename(szOldPath, szBackupPath);        // do nothing when a backup file has existed already\r
        }\r
 \r
@@ -92,7 +93,7 @@ void CDotXkeymacs::LoadUserData(LPCTSTR lpszFileName)
 {\r
        TCHAR szPath[MAX_PATH] = {'\0'};\r
        if (SHGetSpecialFolderPath(NULL, szPath, CSIDL_APPDATA, TRUE)) {\r
-               _tmakepath(szPath, NULL, szPath, lpszFileName, m_szExt);\r
+               _tmakepath_s(szPath, NULL, szPath, lpszFileName, m_szExt);\r
                Load(szPath);\r
        }\r
 }\r
@@ -268,7 +269,10 @@ LPCTSTR CDotXkeymacs::GetLanguage()
        LPCTSTR szLanguage = _T("unknown");\r
 \r
        TCHAR lptstrFilename[MAX_PATH] = {'\0'};\r
-       _tmakepath(lptstrFilename, NULL, _tgetenv(_T("windir")), _T("explorer"), _T("exe"));\r
+       TCHAR windir[MAX_PATH] = "";\r
+       size_t len;\r
+       _tgetenv_s(&len, windir, _T("windir"));\r
+       _tmakepath_s(lptstrFilename, NULL, windir, _T("explorer"), _T("exe"));\r
        DWORD dwLen = GetFileVersionInfoSize(lptstrFilename, NULL);\r
 \r
        if (dwLen) {\r
index 29d7dc2..cc22cf7 100644 (file)
@@ -589,14 +589,14 @@ void CMainFrame::OnHelpFinder()
 {\r
        TCHAR szPath[MAX_PATH] = {'\0'};\r
        const TCHAR szExt[] = _T("txt");\r
-       _tmakepath(szPath, NULL, NULL, CString(MAKEINTRESOURCE(IDS_README)), szExt);\r
+       _tmakepath_s(szPath, NULL, NULL, CString(MAKEINTRESOURCE(IDS_README)), szExt);\r
 \r
        TCHAR szModuleFileName[MAX_PATH] = {'\0'};\r
        if (GetModuleFileName(NULL, szModuleFileName, sizeof(szModuleFileName))) {\r
                TCHAR szDrive[_MAX_DRIVE] = {'\0'};\r
                TCHAR szDir[_MAX_DIR] = {'\0'};\r
-               _tsplitpath(szModuleFileName, szDrive, szDir, NULL, NULL);\r
-               _tmakepath(szPath, szDrive, szDir, CString(MAKEINTRESOURCE(IDS_README)), szExt);\r
+               _tsplitpath_s(szModuleFileName, szDrive, _MAX_DRIVE, szDir, _MAX_DIR, NULL, 0, NULL, 0);\r
+               _tmakepath_s(szPath, szDrive, szDir, CString(MAKEINTRESOURCE(IDS_README)), szExt);\r
        }\r
 \r
        ShellExecute(NULL, NULL, szPath, NULL, NULL, SW_SHOWNORMAL);\r
index ffce7ac..b8f1a80 100644 (file)
@@ -408,7 +408,7 @@ BOOL CALLBACK CProfile::EnumWindowsProc(const HWND hWnd, const LPARAM lParam)
        CComboBox               *pApplication   = (CComboBox*)lParam;\r
        PTASK_LIST              pTask                   = CProfile::m_TaskList;\r
        \r
-       TCHAR szWindowName[WINDOW_NAME_LENGTH];\r
+       TCHAR szWindowName[WINDOW_TEXT_LENGTH];\r
        TCHAR szClassName[CLASS_NAME_LENGTH];\r
        WINDOWPLACEMENT wpl;\r
        \r
index 22081c1..f4fd06a 100644 (file)
@@ -1787,9 +1787,10 @@ int CCommands::YankPop()
 // M-!: cmd.exe/command.com\r
 int CCommands::ShellCommand()\r
 {\r
-       if (!CUtils::Run(_tgetenv(_T("XKEYMACS_SHELL")))) {\r
-               CUtils::Run(_tgetenv(_T("COMSPEC")));\r
-       }\r
+       TCHAR szShell[MAX_PATH];\r
+       size_t len;\r
+       !_tgetenv_s(&len, szShell, _T("XKEYMACS_SHELL")) && len != 0 && CUtils::Run(szShell) ||\r
+               !_tgetenv_s(&len, szShell, _T("COMSPEC")) && len != 0 && CUtils::Run(szShell);\r
        return Reset(GOTO_HOOK);\r
 }\r
 \r
index 965262a..b56df22 100644 (file)
@@ -205,20 +205,20 @@ void CUtils::FairConsoleApplicationName(LPTSTR szApplicationName, LPTSTR szWindo
        }\r
 \r
        if (*szWindowText == '"' && _tcschr(szWindowText+1, _T('"'))) {         // "foo bar" -> foo bar\r
-               int nApplicationName = _tcschr(szWindowText+1, _T('"')) - szWindowText - 1;     // length of "foo bar"\r
-               _tcsncpy(szWindowText, szWindowText + 1, nApplicationName);\r
-               memset(szWindowText + nApplicationName, 0, WINDOW_TEXT_LENGTH - nApplicationName);\r
+               int len = _tcschr(szWindowText+1, _T('"')) - szWindowText - 1;  // length of "foo bar"\r
+               memmove(szWindowText, szWindowText + 1, len);\r
+               memset(szWindowText + len, 0, WINDOW_TEXT_LENGTH - len);\r
        } else if (_tcschr(szWindowText, _T(' '))) {    // foo bar -> foo\r
-               LPTSTR pFirstSpace = _tcschr(szWindowText, _T(' '));\r
-               memset(pFirstSpace, 0, WINDOW_TEXT_LENGTH - (pFirstSpace - szWindowText));\r
+               LPTSTR p = _tcschr(szWindowText, _T(' '));\r
+               memset(p, 0, WINDOW_TEXT_LENGTH - (p - szWindowText));\r
        }\r
 \r
        memset(szApplicationName, 0, MAX_PATH);\r
-       _stprintf(szApplicationName, _T("%s"), szWindowText);\r
+       _stprintf_s(szApplicationName, MAX_PATH, _T("%s"), szWindowText);\r
 \r
        static LPCTSTR const szExe = _T(".exe");\r
        if (_tcsnicmp(szApplicationName + _tcslen(szApplicationName) - _tcslen(szExe), szExe, _tcslen(szExe))) {\r
-               _tcscat(szApplicationName, szExe);\r
+               _tcscat_s(szApplicationName, MAX_PATH, szExe);\r
        }\r
 }\r
 \r
@@ -240,26 +240,26 @@ void CUtils::SetCorrectApplicationName(LPTSTR szApplicationName, LPTSTR szWindow
                        }\r
 \r
                        TCHAR sz[WINDOW_TEXT_LENGTH] = {'\0'};\r
-                       _stprintf(sz, _T("%s%s"), szPromptName[i], szSeparator);\r
+                       _stprintf_s(sz, _T("%s%s"), szPromptName[i], szSeparator);\r
 \r
                        if (!_tcsnicmp(szWindowText, sz, _tcslen(sz))) {        // "Command Promp - foo"\r
-                               _tcscpy(szWindowText, szWindowText + _tcslen(sz));\r
+                               _tcscpy_s(szWindowText, WINDOW_TEXT_LENGTH, szWindowText + _tcslen(sz));\r
                                FairConsoleApplicationName(szApplicationName, szWindowText);\r
                                return;\r
                        }\r
                }\r
 \r
                for (i = 0; i < sizeof(szPromptPath) / sizeof(szPromptPath[0]); ++i) {\r
-                       TCHAR szWindowTextLower[WINDOW_TEXT_LENGTH] = {'\0'};\r
-                       _tcscpy(szWindowTextLower, szWindowText);\r
-                       _tcslwr(szWindowTextLower);\r
+                       TCHAR lower[WINDOW_TEXT_LENGTH] = {'\0'};\r
+                       _tcscpy_s(lower, szWindowText);\r
+                       _tcslwr_s(lower);\r
 \r
-                       if (_tcsstr(szWindowTextLower, szPromptPath[i])) {\r
+                       if (_tcsstr(lower, szPromptPath[i])) {\r
                                TCHAR sz[WINDOW_TEXT_LENGTH] = {'\0'};\r
-                               _stprintf(sz, _T("%s%s"), szPromptPath[i], szSeparator);\r
+                               _stprintf_s(sz, _T("%s%s"), szPromptPath[i], szSeparator);\r
 \r
-                               if (_tcsstr(szWindowTextLower, sz)) {                           // "X:\WINNT\system32\cmd.exe - foo"\r
-                                       _tcscpy(szWindowText, _tcsstr(szWindowTextLower, sz) + _tcslen(sz));\r
+                               if (_tcsstr(lower, sz)) {                               // "X:\WINNT\system32\cmd.exe - foo"\r
+                                       _tcscpy_s(szWindowText, WINDOW_TEXT_LENGTH, _tcsstr(lower, sz) + _tcslen(sz));\r
                                        FairConsoleApplicationName(szApplicationName, szWindowText);\r
                                        return;\r
                                } else {                                                                        // "X:\WINNT\system32\cmd.exe"\r
@@ -269,7 +269,7 @@ void CUtils::SetCorrectApplicationName(LPTSTR szApplicationName, LPTSTR szWindow
                }\r
 \r
                LPTSTR newName = NULL, newText = NULL;\r
-                               if (!_tcsicmp(szWindowText, _T("Cygwin Bash Shell"))\r
+               if (!_tcsicmp(szWindowText, _T("Cygwin Bash Shell"))\r
                 || (*szWindowText == _T('~'))\r
                 || (*szWindowText == _T('/'))) {                                               // Bash\r
                        newName = _T("bash.exe");\r
@@ -302,9 +302,9 @@ void CUtils::SetCorrectApplicationName(LPTSTR szApplicationName, LPTSTR szWindow
                }\r
                if (newName) {\r
                        memset(szApplicationName, 0, MAX_PATH);\r
-                       _stprintf(szApplicationName, newName);\r
+                       _tcscpy_s(szApplicationName, MAX_PATH, newName);\r
                        memset(szWindowText, 0, WINDOW_TEXT_LENGTH);\r
-                       _stprintf(szWindowText, newText);\r
+                       _tcscpy_s(szWindowText, WINDOW_TEXT_LENGTH, newText);\r
                }\r
        } else if (IsJavaW(szApplicationName)) {\r
                LPTSTR newName = NULL;\r
@@ -319,7 +319,7 @@ void CUtils::SetCorrectApplicationName(LPTSTR szApplicationName, LPTSTR szWindow
                }\r
                if (newName) {\r
                        memset(szApplicationName, 0, MAX_PATH);\r
-                       _stprintf(szApplicationName, newName);\r
+                       _tcscpy_s(szApplicationName, MAX_PATH, newName);\r
                }\r
        }\r
        return;\r
@@ -335,7 +335,7 @@ void CUtils::SetApplicationName(BOOL bImeComposition)
                HKL hKL = GetKeyboardLayout(0);\r
                if (ImmIsIME(hKL)) {\r
                        if (!ImmGetIMEFileName(hKL, m_szIMEName, sizeof(m_szIMEName))) {\r
-                               _tcsncpy(m_szIMEName, _T("IME"), sizeof(m_szIMEName));  // IDS_IME_FILE_NAME\r
+                               _tcsncpy_s(m_szIMEName, _T("IME"), _TRUNCATE);  // IDS_IME_FILE_NAME\r
                        }\r
 //                     CUtils::Log(_T("SetApplicationName: m_szIMEName == %s"), m_szIMEName);\r
                }\r
@@ -347,13 +347,13 @@ void CUtils::SetApplicationName(BOOL bImeComposition)
                HKL hKL = GetKeyboardLayout(0);\r
                if (ImmIsIME(hKL)) {\r
                        if (!ImmGetIMEFileName(hKL, m_szApplicationName, sizeof(m_szApplicationName))) {\r
-                               _tcsncpy(m_szApplicationName, m_szIMEName, sizeof(m_szApplicationName));\r
+                               _tcsncpy_s(m_szApplicationName, m_szIMEName, _TRUNCATE);\r
                        }\r
-                       _tcsncpy(m_szIMEName, m_szApplicationName, sizeof(m_szIMEName));\r
+                       _tcsncpy_s(m_szIMEName, m_szApplicationName, sizeof(m_szIMEName));\r
                } else {\r
                        // ImmIsIME return 0 on Word2002, Excel2002, etc. with IME2002, so...\r
                        // _tcsncpy(m_szApplicationName, _T("imjp81.ime"), sizeof(m_szApplicationName));\r
-                       _tcsncpy(m_szApplicationName, m_szIMEName, sizeof(m_szApplicationName));\r
+                       _tcsncpy_s(m_szApplicationName, m_szIMEName, _TRUNCATE);\r
                }\r
        } else {\r
 //             CUtils::Log(_T("SetApplicationName: appication (%s)"), m_szApplicationName);\r
@@ -362,7 +362,7 @@ void CUtils::SetApplicationName(BOOL bImeComposition)
                CString szFn(m_szApplicationName);\r
                szFn.Delete(0, szFn.ReverseFind(_T('\\')) + 1);\r
                ZeroMemory(m_szApplicationName, sizeof(m_szApplicationName));\r
-               _tcsncpy(m_szApplicationName, szFn, szFn.GetLength());\r
+               _tcscpy_s(m_szApplicationName, szFn);\r
 \r
 //             CUtils::Log(_T("SetApplicationName: appication [%s]"), m_szApplicationName);\r
 \r
@@ -370,7 +370,7 @@ void CUtils::SetApplicationName(BOOL bImeComposition)
 //                     CUtils::Log(_T("SetApplicationName: console"));\r
 \r
                        memset(m_szApplicationName, 0, sizeof(m_szApplicationName));\r
-                       _tcscpy(m_szApplicationName, _T("CMD.exe"));\r
+                       _tcscpy_s(m_szApplicationName, _T("CMD.exe"));\r
                        TCHAR szWindowText[WINDOW_TEXT_LENGTH] = {'\0'};\r
                        GetWindowText(GetForegroundWindow(), szWindowText, sizeof(szWindowText));\r
                        SetCorrectApplicationName(m_szApplicationName, szWindowText);\r
@@ -383,7 +383,7 @@ void CUtils::SetApplicationName(BOOL bImeComposition)
 //                     CUtils::Log(_T("SetApplicationName: cygwin"));\r
 \r
                        memset(m_szApplicationName, 0, sizeof(m_szApplicationName));\r
-                       _tcscpy(m_szApplicationName, _T("bash.exe"));\r
+                       _tcscpy_s(m_szApplicationName, _T("bash.exe"));\r
                }\r
 //             CUtils::Log(_T("name: %s"), m_szApplicationName);\r
        }\r
@@ -641,13 +641,13 @@ BOOL CUtils::IsConsole()
 \r
 BOOL CUtils::IsConsole(LPCTSTR szApplicationName)\r
 {\r
-       return !_tcsnicmp(szApplicationName, _T("WINOA386.MOD"), MAX_PATH)\r
-               || !_tcsnicmp(szApplicationName, _T("CMD.exe"), MAX_PATH);\r
+       return !_tcsicmp(szApplicationName, _T("WINOA386.MOD"))\r
+               || !_tcsicmp(szApplicationName, _T("CMD.exe"));\r
 }\r
 \r
 BOOL CUtils::IsJavaW(LPCTSTR szApplicationName)\r
 {\r
-       return !_tcsnicmp(szApplicationName, _T("javaw.exe"), MAX_PATH);\r
+       return !_tcsicmp(szApplicationName, _T("javaw.exe"));\r
 }\r
 \r
 BOOL CUtils::IsSleipnir()\r
@@ -671,11 +671,12 @@ void CUtils::Log(LPTSTR fmt, ...)
 \r
        for (unsigned int nIndex = 0; nIndex < _tcslen(fmt); ) {\r
                LPTSTR pNextString = fmt + nIndex;\r
-               LPTSTR pLogEnd = szLog + _tcslen(szLog);\r
+               int len = _tcslen(szLog);\r
+               LPTSTR pLogEnd = szLog + len;\r
 \r
                if (*pNextString == _T('%')) {\r
                        TCHAR szFormatTag[LOG_MAX] = {'0'};\r
-                       _tcscpy(szFormatTag, pNextString);\r
+                       _tcscpy_s(szFormatTag, pNextString);\r
 \r
                        switch (GetFormatTag(szFormatTag)) {\r
                        case _T('d'):\r
@@ -685,36 +686,37 @@ void CUtils::Log(LPTSTR fmt, ...)
                        case _T('X'):\r
                        case _T('u'):\r
                        case _T('c'):\r
-                               _stprintf(pLogEnd, szFormatTag, va_arg(ap, int));\r
+                               _stprintf_s(pLogEnd, LOG_MAX - len, szFormatTag, va_arg(ap, int));\r
                                break;\r
                        case _T('s'):\r
-                               _stprintf(pLogEnd, szFormatTag, va_arg(ap, LPTSTR));\r
+                               _stprintf_s(pLogEnd, LOG_MAX - len, szFormatTag, va_arg(ap, LPTSTR));\r
                                break;\r
                        case _T('f'):\r
                        case _T('e'):\r
                        case _T('E'):\r
                        case _T('g'):\r
                        case _T('G'):\r
-                               _stprintf(pLogEnd, szFormatTag, va_arg(ap, double));\r
+                               _stprintf_s(pLogEnd, LOG_MAX - len, szFormatTag, va_arg(ap, double));\r
                                break;\r
                        case _T('p'):\r
-                               _stprintf(pLogEnd, szFormatTag, va_arg(ap, void *));\r
+                               _stprintf_s(pLogEnd, LOG_MAX - len, szFormatTag, va_arg(ap, void *));\r
                                break;\r
                        case _T('n'):\r
-                               _stprintf(pLogEnd, szFormatTag, va_arg(ap, int *));\r
+                               _stprintf_s(pLogEnd, LOG_MAX - len, szFormatTag, va_arg(ap, int *));\r
                                break;\r
                        case _T('%'):\r
                        default:\r
-                               _stprintf(pLogEnd, _T("%s"), szFormatTag);\r
+                               _stprintf_s(pLogEnd, LOG_MAX - len, _T("%s"), szFormatTag);\r
                                break;\r
                        }\r
 \r
                        nIndex += _tcslen(szFormatTag);\r
                } else {\r
                        TCHAR szString[LOG_MAX] = {'0'};\r
-                       _tcscpy(szString, pNextString);\r
-                       LPTSTR pString = _tcstok(szString, _T("%"));\r
-                       _stprintf(pLogEnd, _T("%s"), pString);\r
+                       _tcscpy_s(szString, pNextString);\r
+                       LPTSTR c;\r
+                       LPTSTR pString = _tcstok_s(szString, _T("%"), &c);\r
+                       _stprintf_s(pLogEnd, LOG_MAX - len, _T("%s"), pString);\r
 \r
                        nIndex += _tcslen(pString);\r
                }\r
@@ -726,14 +728,15 @@ void CUtils::Log(LPTSTR fmt, ...)
        TCHAR szPath[MAX_PATH] = {'\0'};\r
        if (GetTempPath(MAX_PATH, szPath)) {\r
 #ifndef _WIN64\r
-               _tmakepath(szPath, NULL, szPath, _T("xkeylog"), _T("txt"));\r
+               _tmakepath_s(szPath, NULL, szPath, _T("xkeylog"), _T("txt"));\r
 #else\r
-               _tmakepath(szPath, NULL, szPath, _T("xkeylog64"), _T("txt"));\r
+               _tmakepath_s(szPath, NULL, szPath, _T("xkeylog64"), _T("txt"));\r
 #endif\r
        } else {\r
-               _tcscpy(szPath, _T("c:\\xkeylog.txt"));\r
+               _tcscpy_s(szPath, _T("c:\\xkeylog.txt"));\r
        }\r
-       FILE *fp = _tfopen(szPath, _T("a"));\r
+       FILE *fp;\r
+       _tfopen_s(&fp, szPath, _T("a"));\r
        _ftprintf(fp, _T("%8d: %s       %s\n"), n++, m_szApplicationName, szLog);\r
        fflush(fp);\r
        fclose(fp);\r
index 020a404..bcbd506 100644 (file)
@@ -1238,14 +1238,14 @@ void CXkeymacsDll::SetModifierIcons()
 \r
 void CXkeymacsDll::SetApplicationName(int nApplicationID, CString szApplicationName)\r
 {\r
-       ZeroMemory(m_Config.szSpecialApp[nApplicationID], sizeof(m_Config.szSpecialApp[nApplicationID]));\r
-       _tcsncpy(m_Config.szSpecialApp[nApplicationID], szApplicationName, sizeof(m_Config.szSpecialApp[nApplicationID]));\r
+       ZeroMemory(m_Config.szSpecialApp[nApplicationID], CLASS_NAME_LENGTH);\r
+       _tcsncpy_s(m_Config.szSpecialApp[nApplicationID], szApplicationName, _TRUNCATE);\r
 }\r
 \r
 void CXkeymacsDll::SetWindowText(int nApplicationID, CString szWindowText)\r
 {\r
-       ZeroMemory(m_Config.szWindowText[nApplicationID], sizeof(m_Config.szWindowText[nApplicationID]));\r
-       _tcsncpy(m_Config.szWindowText[nApplicationID], szWindowText, sizeof(m_Config.szWindowText[nApplicationID]));\r
+       ZeroMemory(m_Config.szWindowText[nApplicationID], WINDOW_TEXT_LENGTH);\r
+       _tcsncpy_s(m_Config.szWindowText[nApplicationID], szWindowText, _TRUNCATE);\r
 }\r
 \r
 void CXkeymacsDll::SetCommandID(int nApplicationID, int nCommandType, int nKey, int nCommandID)\r
@@ -1694,7 +1694,7 @@ void CXkeymacsDll::SetFunctionDefinition(int nFunctionID, CString szDefinition)
        }\r
 \r
        memset(m_Config.szFunctionDefinition[nFunctionID], 0, sizeof(m_Config.szFunctionDefinition[nFunctionID]));\r
-       _stprintf(m_Config.szFunctionDefinition[nFunctionID], _T("%s"), szDefinition);\r
+       _stprintf_s(m_Config.szFunctionDefinition[nFunctionID], _T("%s"), szDefinition);\r
 \r
        return;\r
 \r