[EU-FOSSA] Use wcscpy_s instead of lstrcpy to prevent from buffer overflow

This commit is contained in:
Don HO 2019-02-11 02:07:04 +01:00
parent b381ea5353
commit 7fe3cda1d0
26 changed files with 76 additions and 65 deletions

View File

@ -1219,7 +1219,7 @@ bool deleteFileOrFolder(const generic_string& f2delete)
{
auto len = f2delete.length();
TCHAR* actionFolder = new TCHAR[len + 2];
lstrcpy(actionFolder, f2delete.c_str());
wcscpy_s(actionFolder, len + 2, f2delete.c_str());
actionFolder[len] = 0;
actionFolder[len + 1] = 0;

View File

@ -211,7 +211,7 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath)
}
TCHAR xmlPath[MAX_PATH];
lstrcpy(xmlPath, nppParams->getNppPath().c_str());
wcscpy_s(xmlPath, nppParams->getNppPath().c_str());
PathAppend(xmlPath, TEXT("plugins\\Config"));
PathAppend(xmlPath, pi->_moduleName.c_str());
PathRemoveExtension(xmlPath);
@ -220,7 +220,7 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath)
if (!PathFileExists(xmlPath))
{
lstrcpyn(xmlPath, TEXT("\0"), MAX_PATH );
lstrcpy(xmlPath, nppParams->getAppDataNppDir() );
wcscpy_s(xmlPath, nppParams->getAppDataNppDir() );
PathAppend(xmlPath, TEXT("plugins\\Config"));
PathAppend(xmlPath, pi->_moduleName.c_str());
PathRemoveExtension( xmlPath );

View File

@ -2480,11 +2480,12 @@ void Notepad_plus::addHotSpot()
hotspotStyle._styleID = static_cast<int>(style_hotspot);
_pEditView->execute(SCI_STYLEGETFONT, idStyleMSBunset, reinterpret_cast<LPARAM>(fontNameA));
TCHAR *generic_fontname = new TCHAR[128];
const size_t generic_fontnameLen = 128;
TCHAR *generic_fontname = new TCHAR[generic_fontnameLen];
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
const wchar_t * fontNameW = wmc->char2wchar(fontNameA, _nativeLangSpeaker.getLangEncoding());
lstrcpy(generic_fontname, fontNameW);
wcscpy_s(generic_fontname, generic_fontnameLen, fontNameW);
hotspotStyle._fontName = generic_fontname;
hotspotStyle._fgColor = static_cast<COLORREF>(_pEditView->execute(SCI_STYLEGETFORE, idStyleMSBunset));
@ -5798,7 +5799,7 @@ void Notepad_plus::launchClipboardHistoryPanel()
static TCHAR title[32];
if (title_temp.length() < 32)
{
lstrcpy(title, title_temp.c_str());
wcscpy_s(title, title_temp.c_str());
data.pszName = title;
}
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
@ -5841,7 +5842,7 @@ void Notepad_plus::launchFileSwitcherPanel()
static TCHAR title[32];
if (title_temp.length() < 32)
{
lstrcpy(title, title_temp.c_str());
wcscpy_s(title, title_temp.c_str());
data.pszName = title;
}
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
@ -5882,7 +5883,7 @@ void Notepad_plus::launchAnsiCharPanel()
static TCHAR title[32];
if (title_temp.length() < 32)
{
lstrcpy(title, title_temp.c_str());
wcscpy_s(title, title_temp.c_str());
data.pszName = title;
}
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
@ -5926,7 +5927,7 @@ void Notepad_plus::launchFileBrowser(const vector<generic_string> & folders)
static TCHAR title[32];
if (title_temp.length() < 32)
{
lstrcpy(title, title_temp.c_str());
wcscpy_s(title, title_temp.c_str());
data.pszName = title;
}
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
@ -5983,7 +5984,7 @@ void Notepad_plus::launchProjectPanel(int cmdID, ProjectPanel ** pProjPanel, int
static TCHAR title[32];
if (title_temp.length() < 32)
{
lstrcpy(title, title_temp.c_str());
wcscpy_s(title, title_temp.c_str());
data.pszName = title;
}
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
@ -6035,7 +6036,7 @@ void Notepad_plus::launchDocMap()
static TCHAR title[32];
if (title_temp.length() < 32)
{
lstrcpy(title, title_temp.c_str());
wcscpy_s(title, title_temp.c_str());
data.pszName = title;
}
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
@ -6076,7 +6077,7 @@ void Notepad_plus::launchFunctionList()
static TCHAR title[32];
if (title_temp.length() < 32)
{
lstrcpy(title, title_temp.c_str());
wcscpy_s(title, title_temp.c_str());
data.pszName = title;
}

View File

@ -688,7 +688,8 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
{
TCHAR str[MAX_PATH];
// par defaut : NPPM_GETCURRENTDIRECTORY
TCHAR *fileStr = lstrcpy(str, _pEditView->getCurrentBuffer()->getFullPathName());
wcscpy_s(str, _pEditView->getCurrentBuffer()->getFullPathName());
TCHAR* fileStr = str;
if (message == NPPM_GETCURRENTDIRECTORY)
PathRemoveFileSpec(str);

View File

@ -402,7 +402,7 @@ void Notepad_plus::command(int id)
TCHAR cmd2Exec[CURRENTWORD_MAXLENGTH];
if (id == IDM_EDIT_OPENINFOLDER)
{
lstrcpy(cmd2Exec, TEXT("explorer"));
wcscpy_s(cmd2Exec, TEXT("explorer"));
}
else
{

View File

@ -50,7 +50,7 @@ DWORD WINAPI Notepad_plus::monitorFileOnChange(void * params)
//The folder to watch :
WCHAR folderToMonitor[MAX_PATH];
lstrcpy(folderToMonitor, fullFileName);
wcscpy_s(folderToMonitor, fullFileName);
::PathRemoveFileSpecW(folderToMonitor);
@ -153,7 +153,7 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
bool isSnapshotMode = backupFileName != NULL && PathFileExists(backupFileName);
if (isSnapshotMode && !PathFileExists(longFileName)) // UNTITLED
{
lstrcpy(longFileName, fileName.c_str());
wcscpy_s(longFileName, fileName.c_str());
}

View File

@ -882,7 +882,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
if (tipTmp.length() >= 80)
return FALSE;
lstrcpy(lpttt->szText, tipTmp.c_str());
wcscpy_s(lpttt->szText, tipTmp.c_str());
return TRUE;
}
else if (hWin == _mainDocTab.getHSelf())
@ -893,7 +893,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
if (tipTmp.length() >= tipMaxLen)
return FALSE;
lstrcpy(docTip, tipTmp.c_str());
wcscpy_s(docTip, tipTmp.c_str());
lpttt->lpszText = docTip;
return TRUE;
}
@ -905,7 +905,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
if (tipTmp.length() >= tipMaxLen)
return FALSE;
lstrcpy(docTip, tipTmp.c_str());
wcscpy_s(docTip, tipTmp.c_str());
lpttt->lpszText = docTip;
return TRUE;
}

View File

@ -999,7 +999,7 @@ bool NppParameters::load()
{
generic_string progPath = getSpecialFolderLocation(CSIDL_PROGRAM_FILES);
TCHAR nppDirLocation[MAX_PATH];
lstrcpy(nppDirLocation, _nppPath.c_str());
wcscpy_s(nppDirLocation, _nppPath.c_str());
::PathRemoveFileSpec(nppDirLocation);
if (progPath == nppDirLocation)
@ -3344,7 +3344,7 @@ void NppParameters::feedUserKeywordList(TiXmlNode *node)
temp += TEXT(" 08"); if (kwl[5] != '0') temp += kwl[5];
temp += TEXT(" 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23");
lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[SCE_USER_KWLIST_DELIMITERS], temp.c_str());
wcscpy_s(_userLangArray[_nbUserLang - 1]->_keywordLists[SCE_USER_KWLIST_DELIMITERS], temp.c_str());
}
else if (!lstrcmp(keywordsName, TEXT("Comment")))
{
@ -3378,7 +3378,7 @@ void NppParameters::feedUserKeywordList(TiXmlNode *node)
if (temp[0] == ' ')
temp.erase(0, 1);
lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[SCE_USER_KWLIST_COMMENTS], temp.c_str());
wcscpy_s(_userLangArray[_nbUserLang - 1]->_keywordLists[SCE_USER_KWLIST_COMMENTS], temp.c_str());
}
else
{
@ -3388,11 +3388,11 @@ void NppParameters::feedUserKeywordList(TiXmlNode *node)
id = globalMappper().keywordIdMapper[keywordsName];
if (_tcslen(kwl) < max_char)
{
lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[id], kwl);
wcscpy_s(_userLangArray[_nbUserLang - 1]->_keywordLists[id], kwl);
}
else
{
lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[id], TEXT("imported string too long, needs to be < max_char(30720)"));
wcscpy_s(_userLangArray[_nbUserLang - 1]->_keywordLists[id], TEXT("imported string too long, needs to be < max_char(30720)"));
}
}
}
@ -6627,12 +6627,16 @@ void NppParameters::stylerStrOp(bool op)
if (op == DUP)
{
TCHAR *str = new TCHAR[lstrlen(style._styleDesc) + 1];
style._styleDesc = lstrcpy(str, style._styleDesc);
const size_t strLen = lstrlen(style._styleDesc) + 1;
TCHAR *str = new TCHAR[strLen];
wcscpy_s(str, strLen, style._styleDesc);
style._styleDesc = str;
if (style._fontName)
{
str = new TCHAR[lstrlen(style._fontName) + 1];
style._fontName = lstrcpy(str, style._fontName);
const size_t strLen2 = lstrlen(style._fontName) + 1;
str = new TCHAR[strLen2];
wcscpy_s(str, strLen2, style._fontName);
style._fontName = str;
}
else
{

View File

@ -1043,7 +1043,7 @@ public:
}
for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; ++i)
lstrcpy(this->_keywordLists[i], ulc._keywordLists[i]);
wcscpy_s(this->_keywordLists[i], ulc._keywordLists[i]);
for (int i = 0 ; i < SCE_USER_TOTAL_KEYWORD_GROUPS ; ++i)
_isPrefix[i] = ulc._isPrefix[i];

View File

@ -594,7 +594,7 @@ BufferID FileManager::loadFile(const TCHAR * filename, Document doc, int encodin
bool isSnapshotMode = backupFileName != NULL && PathFileExists(backupFileName);
if (isSnapshotMode && !PathFileExists(fullpath)) // if backup mode and fullpath doesn't exist, we guess is UNTITLED
{
lstrcpy(fullpath, filename); // we restore fullpath with filename, in our case is "new #"
wcscpy_s(fullpath, MAX_PATH, filename); // we restore fullpath with filename, in our case is "new #"
}
Utf8_16_Read UnicodeConvertor; //declare here so we can get information after loading is done
@ -1471,8 +1471,10 @@ int FileManager::getFileNameFromBuffer(BufferID id, TCHAR * fn2copy)
return -1;
Buffer* buf = getBufferByID(id);
if (fn2copy)
lstrcpy(fn2copy, buf->getFullPathName());
return lstrlen(buf->getFullPathName());
}

View File

@ -1496,7 +1496,7 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, const FindOption *op
int stringSizeFind = lstrlen(txt2find);
TCHAR *pText = new TCHAR[stringSizeFind + 1];
lstrcpy(pText, txt2find);
wcscpy_s(pText, stringSizeFind + 1, txt2find);
if (pOptions->_searchType == FindExtended) {
stringSizeFind = Searching::convertExtendedToString(txt2find, pText, stringSizeFind);
@ -1871,13 +1871,13 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
generic_string str2Search = getTextFromCombo(hFindCombo);
stringSizeFind = str2Search.length();
pTextFind = new TCHAR[stringSizeFind + 1];
lstrcpy(pTextFind, str2Search.c_str());
wcscpy_s(pTextFind, stringSizeFind + 1, str2Search.c_str());
}
else
{
stringSizeFind = lstrlen(findReplaceInfo._txt2find);
pTextFind = new TCHAR[stringSizeFind + 1];
lstrcpy(pTextFind, findReplaceInfo._txt2find);
wcscpy_s(pTextFind, stringSizeFind + 1, findReplaceInfo._txt2find);
}
if (!pTextFind[0])
@ -1895,13 +1895,13 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
generic_string str2Replace = getTextFromCombo(hReplaceCombo);
stringSizeReplace = str2Replace.length();
pTextReplace = new TCHAR[stringSizeReplace + 1];
lstrcpy(pTextReplace, str2Replace.c_str());
wcscpy_s(pTextReplace, stringSizeReplace + 1, str2Replace.c_str());
}
else
{
stringSizeReplace = lstrlen(findReplaceInfo._txt2replace);
pTextReplace = new TCHAR[stringSizeReplace + 1];
lstrcpy(pTextReplace, findReplaceInfo._txt2replace);
wcscpy_s(pTextReplace, stringSizeReplace + 1, findReplaceInfo._txt2replace);
}
}

View File

@ -280,7 +280,7 @@ bool FunctionCallTip::getCursorFunction()
delete [] _funcName;
}
_funcName = new TCHAR[funcToken.length+1];
lstrcpy(_funcName, funcToken.token);
wcscpy_s(_funcName, funcToken.length+1, funcToken.token);
res = loadFunction();
}
else

View File

@ -2120,7 +2120,7 @@ TCHAR * ScintillaEditView::getGenericWordOnCaretPos(TCHAR * txt, int size)
getWordOnCaretPos(txtA, size);
const TCHAR * txtW = wmc->char2wchar(txtA, cp);
lstrcpy(txt, txtW);
wcscpy_s(txt, size, txtW);
delete [] txtA;
return txt;
}
@ -2151,7 +2151,7 @@ TCHAR * ScintillaEditView::getGenericSelectedText(TCHAR * txt, int size, bool ex
getSelectedText(txtA, size, expand);
const TCHAR * txtW = wmc->char2wchar(txtA, cp);
lstrcpy(txt, txtW);
wcscpy_s(txt, size, txtW);
delete [] txtA;
return txt;
}
@ -2824,7 +2824,7 @@ TCHAR * int2str(TCHAR *str, int strLen, int number, int base, int nbChiffre, boo
for ( ; *j != '\0' ; ++j)
if (*j == '1')
break;
lstrcpy(str, j);
wcscpy_s(str, strLen, j);
}
else
{

View File

@ -524,7 +524,7 @@ void CommentStyleDialog::setKeywords2List(int id)
convertTo(newList, max_char, buffer, intBuffer);
}
lstrcpy(_pUserLang->_keywordLists[index], newList);
wcscpy_s(_pUserLang->_keywordLists[index], newList);
}
}
@ -836,7 +836,7 @@ void SymbolsStyleDialog::setKeywords2List(int id)
convertTo(newList, max_char, buffer, intBuffer);
}
lstrcpy(_pUserLang->_keywordLists[SCE_USER_KWLIST_DELIMITERS], newList);
wcscpy_s(_pUserLang->_keywordLists[SCE_USER_KWLIST_DELIMITERS], newList);
break;
}
default :

View File

@ -105,10 +105,11 @@ void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_STRING* outString )
// <-- Strange class for a bug fix. Search for STL_STRING_BUG
TiXmlBase::StringToBuffer::StringToBuffer( const TIXML_STRING& str )
{
buffer = new TCHAR[ str.length()+1 ];
if ( buffer )
const size_t strLen = str.length() + 1;
buffer = new TCHAR[strLen];
if (buffer)
{
lstrcpy( buffer, str.c_str() );
wcscpy_s(buffer, strLen, str.c_str());
}
}

View File

@ -643,7 +643,7 @@ void WordStyleDlg::switchToTheme()
if (_isThemeDirty)
{
TCHAR themeFileName[MAX_PATH];
lstrcpy(themeFileName, prevThemeName.c_str());
wcscpy_s(themeFileName, prevThemeName.c_str());
PathStripPath(themeFileName);
PathRemoveExtension(themeFileName);
int mb_response =

View File

@ -910,7 +910,7 @@ void FileBrowser::addRootFolder(generic_string rootFolderPath)
TCHAR *label = ::PathFindFileName(rootFolderPath.c_str());
TCHAR rootLabel[MAX_PATH];
lstrcpy(rootLabel, label);
wcscpy_s(rootLabel, label);
size_t len = lstrlen(rootLabel);
if (rootLabel[len - 1] == '\\')
rootLabel[len - 1] = '\0';
@ -929,7 +929,7 @@ HTREEITEM FileBrowser::createFolderItemsFromDirStruct(HTREEITEM hParentItem, con
if (directoryStructure._parent == nullptr && hParentItem == nullptr)
{
TCHAR rootPath[MAX_PATH];
lstrcpy(rootPath, directoryStructure._rootPath.c_str());
wcscpy_s(rootPath, directoryStructure._rootPath.c_str());
size_t len = lstrlen(rootPath);
if (rootPath[len - 1] == '\\')
rootPath[len - 1] = '\0';

View File

@ -513,11 +513,11 @@ void FunctionListPanel::notified(LPNMHDR notification)
if (notification->idFrom == IDC_SORTBUTTON_FUNCLIST)
{
lstrcpy(lpttt->szText, _sortTipStr.c_str());
wcscpy_s(lpttt->szText, _sortTipStr.c_str());
}
else if (notification->idFrom == IDC_RELOADBUTTON_FUNCLIST)
{
lstrcpy(lpttt->szText, _reloadTipStr.c_str());
wcscpy_s(lpttt->szText, _reloadTipStr.c_str());
}
}
else if (notification->hwndFrom == _treeView.getHSelf() || notification->hwndFrom == this->_treeViewSearchResult.getHSelf())

View File

@ -146,11 +146,13 @@ int FileDialog::setExtsFilter(const TCHAR *extText, const TCHAR *exts)
// Append new filter
TCHAR *pFileExt = _fileExt + _nbCharFileExt;
lstrcpy(pFileExt, extFilter.c_str());
int curLen = nbCharNewFileExt - _nbCharFileExt;
wcscpy_s(pFileExt, curLen, extFilter.c_str());
_nbCharFileExt += static_cast<int32_t>(extFilter.length()) + 1;
pFileExt = _fileExt + _nbCharFileExt;
lstrcpy(pFileExt, exts);
curLen -= _nbCharFileExt;
wcscpy_s(pFileExt, curLen, exts);
_nbCharFileExt += lstrlen(exts) + 1;
// Set file dialog pointer
@ -240,7 +242,7 @@ stringVector * FileDialog::doOpenMultiFilesDlg()
}
else
{
lstrcpy(fn, _fileName);
wcscpy_s(fn, _fileName);
if (fn[lstrlen(fn) - 1] != '\\')
lstrcat(fn, TEXT("\\"));
}

View File

@ -49,7 +49,7 @@ public:
void setExtFilter(const TCHAR *, const TCHAR *, ...);
int setExtsFilter(const TCHAR *extText, const TCHAR *exts);
void setDefFileName(const TCHAR *fn){lstrcpy(_fileName, fn);}
void setDefFileName(const TCHAR *fn){ wcscpy_s(_fileName, fn);}
TCHAR * doSaveDlg();
stringVector * doOpenMultiFilesDlg();

View File

@ -809,7 +809,7 @@ bool PluginsAdminDlg::loadFromPluginInfos()
// user file name (without ext. to find whole info in available list
TCHAR fnNoExt[MAX_PATH];
lstrcpy(fnNoExt, i._fileName.c_str());
wcscpy_s(fnNoExt, i._fileName.c_str());
::PathRemoveExtension(fnNoExt);
int listIndex;

View File

@ -1367,7 +1367,7 @@ INT_PTR CALLBACK DefaultDirectoryDlg::run_dlgProc(UINT message, WPARAM wParam, L
{
TCHAR inputDir[MAX_PATH];
::SendDlgItemMessage(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(inputDir));
lstrcpy(nppGUI._defaultDir, inputDir);
wcscpy_s(nppGUI._defaultDir, inputDir);
::ExpandEnvironmentStrings(nppGUI._defaultDir, nppGUI._defaultDirExp, _countof(nppGUI._defaultDirExp));
pNppParam->setWorkingDir(nppGUI._defaultDirExp);
return TRUE;

View File

@ -474,7 +474,7 @@ void ProjectPanel::buildProjectXml(TiXmlNode *node, HTREEITEM hItem, const TCHAR
generic_string ProjectPanel::getRelativePath(const generic_string & filePath, const TCHAR *workSpaceFileName)
{
TCHAR wsfn[MAX_PATH];
lstrcpy(wsfn, workSpaceFileName);
wcscpy_s(wsfn, workSpaceFileName);
::PathRemoveFileSpec(wsfn);
size_t pos_found = filePath.find(wsfn);
@ -521,7 +521,7 @@ generic_string ProjectPanel::getAbsoluteFilePath(const TCHAR * relativePath)
return relativePath;
TCHAR absolutePath[MAX_PATH];
lstrcpy(absolutePath, _workSpaceFilePath.c_str());
wcscpy_s(absolutePath, _workSpaceFilePath.c_str());
::PathRemoveFileSpec(absolutePath);
::PathAppend(absolutePath, relativePath);
return absolutePath;
@ -1092,7 +1092,7 @@ void ProjectPanel::popupMenuCmd(int cmdID)
*fn = newValue;
TCHAR *strValueLabel = ::PathFindFileName(fn->c_str());
lstrcpy(textBuffer, strValueLabel);
wcscpy_s(textBuffer, strValueLabel);
int iImage = ::PathFileExists(fn->c_str())?INDEX_LEAF:INDEX_LEAF_INVALID;
tvItem.iImage = tvItem.iSelectedImage = iImage;
SendMessage(_treeView.getHSelf(), TVM_SETITEM, 0, reinterpret_cast<LPARAM>(&tvItem));
@ -1215,7 +1215,7 @@ void ProjectPanel::addFilesFromDirectory(HTREEITEM hTreeItem)
if (_selDirOfFilesFromDirDlg == TEXT("") && _workSpaceFilePath != TEXT(""))
{
TCHAR dir[MAX_PATH];
lstrcpy(dir, _workSpaceFilePath.c_str());
wcscpy_s(dir, _workSpaceFilePath.c_str());
::PathRemoveFileSpec(dir);
_selDirOfFilesFromDirDlg = dir;
}

View File

@ -181,13 +181,13 @@ HINSTANCE Command::run(HWND hWnd)
extractArgs(cmdPure, args, _cmdLine.c_str());
int nbTchar = ::ExpandEnvironmentStrings(cmdPure, cmdIntermediate, MAX_PATH);
if (!nbTchar)
lstrcpy(cmdIntermediate, cmdPure);
wcscpy_s(cmdIntermediate, cmdPure);
else if (nbTchar >= MAX_PATH)
cmdIntermediate[MAX_PATH-1] = '\0';
nbTchar = ::ExpandEnvironmentStrings(args, argsIntermediate, argsIntermediateLen);
if (!nbTchar)
lstrcpy(argsIntermediate, args);
wcscpy_s(argsIntermediate, args);
else if (nbTchar >= argsIntermediateLen)
argsIntermediate[argsIntermediateLen-1] = '\0';

View File

@ -36,7 +36,7 @@ trayIconControler::trayIconControler(HWND hwnd, UINT uID, UINT uCBMsg, HICON hic
_nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
_nid.uCallbackMessage = uCBMsg;
_nid.hIcon = hicon;
lstrcpy(_nid.szTip, tip);
wcscpy_s(_nid.szTip, tip);
::RegisterWindowMessage(TEXT("TaskbarCreated"));
_isIconShowed = false;

View File

@ -153,7 +153,7 @@ void VerticalFileSwitcherListView::initList()
TaskLstFnStatus *tl = new TaskLstFnStatus(fileNameStatus._iView, fileNameStatus._docIndex, fileNameStatus._fn, fileNameStatus._status, (void *)fileNameStatus._bufID);
TCHAR fn[MAX_PATH];
lstrcpy(fn, ::PathFindFileName(fileNameStatus._fn.c_str()));
wcscpy_s(fn, ::PathFindFileName(fileNameStatus._fn.c_str()));
if (isExtColumn)
{
@ -213,7 +213,7 @@ void VerticalFileSwitcherListView::setItemIconStatus(BufferID bufferID)
Buffer *buf = static_cast<Buffer *>(bufferID);
TCHAR fn[MAX_PATH];
lstrcpy(fn, ::PathFindFileName(buf->getFileName()));
wcscpy_s(fn, ::PathFindFileName(buf->getFileName()));
bool isExtColumn = !(NppParameters::getInstance())->getNppGUI()._fileSwitcherWithoutExtColumn;
if (isExtColumn)
{
@ -290,7 +290,7 @@ int VerticalFileSwitcherListView::add(BufferID bufferID, int iView)
TaskLstFnStatus *tl = new TaskLstFnStatus(iView, 0, buf->getFullPathName(), 0, (void *)bufferID);
TCHAR fn[MAX_PATH];
lstrcpy(fn, ::PathFindFileName(fileName));
wcscpy_s(fn, ::PathFindFileName(fileName));
bool isExtColumn = !(NppParameters::getInstance())->getNppGUI()._fileSwitcherWithoutExtColumn;
if (isExtColumn)
{