[EU-FOSSA] Replace lstrcat by wcscat_s to avoid crash
This commit is contained in:
parent
70cd3e5ea6
commit
bd7816755c
@ -54,7 +54,7 @@ bool MiniDumper::writeDump(EXCEPTION_POINTERS * pExceptionInfo)
|
|||||||
{
|
{
|
||||||
::GetModuleFileName(NULL, szDumpPath, MAX_PATH);
|
::GetModuleFileName(NULL, szDumpPath, MAX_PATH);
|
||||||
::PathRemoveFileSpec(szDumpPath);
|
::PathRemoveFileSpec(szDumpPath);
|
||||||
lstrcat(szDumpPath, TEXT("\\NppDump.dmp"));
|
wcscat_s(szDumpPath, TEXT("\\NppDump.dmp"));
|
||||||
|
|
||||||
// ask the user if they want to save a dump file
|
// ask the user if they want to save a dump file
|
||||||
int msgret = ::MessageBox(NULL, TEXT("Do you want to save a dump file?\r\nDoing so can aid in developing Notepad++."), msgTitle, MB_YESNO);
|
int msgret = ::MessageBox(NULL, TEXT("Do you want to save a dump file?\r\nDoing so can aid in developing Notepad++."), msgTitle, MB_YESNO);
|
||||||
|
@ -365,7 +365,7 @@ bool RegExtDlg::deleteExts(const TCHAR *ext2Delete)
|
|||||||
if ((nbValue <= 1) && (!nbSubkey))
|
if ((nbValue <= 1) && (!nbSubkey))
|
||||||
{
|
{
|
||||||
TCHAR subKey[32] = TEXT("\\");
|
TCHAR subKey[32] = TEXT("\\");
|
||||||
lstrcat(subKey, ext2Delete);
|
wcscat_s(subKey, ext2Delete);
|
||||||
::RegDeleteKey(HKEY_CLASSES_ROOT, subKey);
|
::RegDeleteKey(HKEY_CLASSES_ROOT, subKey);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -412,7 +412,8 @@ void RegExtDlg::writeNppPath()
|
|||||||
::GetModuleFileName(_hInst, nppPath, MAX_PATH);
|
::GetModuleFileName(_hInst, nppPath, MAX_PATH);
|
||||||
|
|
||||||
TCHAR nppPathParam[MAX_PATH] = TEXT("\"");
|
TCHAR nppPathParam[MAX_PATH] = TEXT("\"");
|
||||||
lstrcat(lstrcat(nppPathParam, nppPath), TEXT("\" \"%1\""));
|
wcscat_s(nppPathParam, nppPath);
|
||||||
|
wcscat_s(nppPathParam, TEXT("\" \"%1\""));
|
||||||
|
|
||||||
::RegSetValueEx(hKey, nullptr, 0, REG_SZ, (LPBYTE)nppPathParam, (lstrlen(nppPathParam)+1)*sizeof(TCHAR));
|
::RegSetValueEx(hKey, nullptr, 0, REG_SZ, (LPBYTE)nppPathParam, (lstrlen(nppPathParam)+1)*sizeof(TCHAR));
|
||||||
}
|
}
|
||||||
@ -432,7 +433,8 @@ void RegExtDlg::writeNppPath()
|
|||||||
::GetModuleFileName(_hInst, nppPath, MAX_PATH);
|
::GetModuleFileName(_hInst, nppPath, MAX_PATH);
|
||||||
|
|
||||||
TCHAR nppPathParam[MAX_PATH] = TEXT("\"");
|
TCHAR nppPathParam[MAX_PATH] = TEXT("\"");
|
||||||
lstrcat(lstrcat(nppPathParam, nppPath), TEXT("\",0"));
|
wcscat_s(nppPathParam, nppPath);
|
||||||
|
wcscat_s(nppPathParam, TEXT("\",0"));
|
||||||
|
|
||||||
::RegSetValueEx(hKey, nullptr, 0, REG_SZ, (LPBYTE)nppPathParam, (lstrlen(nppPathParam)+1)*sizeof(TCHAR));
|
::RegSetValueEx(hKey, nullptr, 0, REG_SZ, (LPBYTE)nppPathParam, (lstrlen(nppPathParam)+1)*sizeof(TCHAR));
|
||||||
}
|
}
|
||||||
|
@ -768,9 +768,9 @@ bool AutoCompletion::setLanguage(LangType language) {
|
|||||||
TCHAR path[MAX_PATH];
|
TCHAR path[MAX_PATH];
|
||||||
::GetModuleFileName(NULL, path, MAX_PATH);
|
::GetModuleFileName(NULL, path, MAX_PATH);
|
||||||
PathRemoveFileSpec(path);
|
PathRemoveFileSpec(path);
|
||||||
lstrcat(path, TEXT("\\autoCompletion\\"));
|
wcscat_s(path, TEXT("\\autoCompletion\\"));
|
||||||
lstrcat(path, getApiFileName());
|
wcscat_s(path, getApiFileName());
|
||||||
lstrcat(path, TEXT(".xml"));
|
wcscat_s(path, TEXT(".xml"));
|
||||||
|
|
||||||
if (_pXmlFile)
|
if (_pXmlFile)
|
||||||
delete _pXmlFile;
|
delete _pXmlFile;
|
||||||
|
@ -210,7 +210,6 @@ void TiXmlStringA::append( const char * suffix )
|
|||||||
// strcpy (new_string, cstring);
|
// strcpy (new_string, cstring);
|
||||||
|
|
||||||
// append the suffix. It does exist, otherwize we wouldn't be expanding
|
// append the suffix. It does exist, otherwize we wouldn't be expanding
|
||||||
// strcat (new_string, suffix);
|
|
||||||
memcpy (new_string + length (),
|
memcpy (new_string + length (),
|
||||||
suffix,
|
suffix,
|
||||||
strlen (suffix) + 1);
|
strlen (suffix) + 1);
|
||||||
@ -226,7 +225,6 @@ void TiXmlStringA::append( const char * suffix )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// we know we can safely append the new string
|
// we know we can safely append the new string
|
||||||
// strcat (cstring, suffix);
|
|
||||||
memcpy (cstring + length (),
|
memcpy (cstring + length (),
|
||||||
suffix,
|
suffix,
|
||||||
strlen (suffix) + 1);
|
strlen (suffix) + 1);
|
||||||
|
@ -201,7 +201,6 @@ void TiXmlString::append( const TCHAR * suffix )
|
|||||||
memcpy (new_string, cstring, 1 + length ());
|
memcpy (new_string, cstring, 1 + length ());
|
||||||
|
|
||||||
// append the suffix. It does exist, otherwize we wouldn't be expanding
|
// append the suffix. It does exist, otherwize we wouldn't be expanding
|
||||||
// lstrcat (new_string, suffix);
|
|
||||||
memcpy (new_string + length (),
|
memcpy (new_string + length (),
|
||||||
suffix,
|
suffix,
|
||||||
lstrlen (suffix) + 1);
|
lstrlen (suffix) + 1);
|
||||||
@ -217,7 +216,6 @@ void TiXmlString::append( const TCHAR * suffix )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// we know we can safely append the new generic_string
|
// we know we can safely append the new generic_string
|
||||||
// lstrcat (cstring, suffix);
|
|
||||||
memcpy (cstring + length (),
|
memcpy (cstring + length (),
|
||||||
suffix,
|
suffix,
|
||||||
lstrlen (suffix) + 1);
|
lstrlen (suffix) + 1);
|
||||||
|
@ -744,11 +744,11 @@ void WordStyleDlg::setVisualFromStyleList()
|
|||||||
if (lbTextLen > styleNameLen)
|
if (lbTextLen > styleNameLen)
|
||||||
return;
|
return;
|
||||||
::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXT, i, reinterpret_cast<LPARAM>(styleName));
|
::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXT, i, reinterpret_cast<LPARAM>(styleName));
|
||||||
|
wcscat_s(str, TEXT(" : "));
|
||||||
lstrcat(lstrcat(str, TEXT(" : ")), styleName);
|
wcscat_s(str, styleName);
|
||||||
|
|
||||||
// PAD for fix a display glitch
|
// PAD for fix a display glitch
|
||||||
lstrcat(str, TEXT(" "));
|
wcscat_s(str, TEXT(" "));
|
||||||
colourHooker.setColour(c);
|
colourHooker.setColour(c);
|
||||||
::SetWindowText(_hStyleInfoStaticText, str);
|
::SetWindowText(_hStyleInfoStaticText, str);
|
||||||
|
|
||||||
|
@ -1186,8 +1186,8 @@ void DisplayEditString(HWND hWnd,int SI, const TCHAR* tstring)
|
|||||||
|
|
||||||
if(lstrlen(BGHS[SI].editstring)<=300)
|
if(lstrlen(BGHS[SI].editstring)<=300)
|
||||||
{
|
{
|
||||||
lstrcat(BGHS[SI].editstring,tstring);
|
wcscat_s(BGHS[SI].editstring,tstring);
|
||||||
lstrcpy(BGHS[SI].editstringdisplay,BGHS[SI].editstring);
|
wcscat_s(BGHS[SI].editstringdisplay,BGHS[SI].editstring);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1577,16 +1577,16 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
//protecting or unprotecting a cell that isn't in the list
|
//protecting or unprotecting a cell that isn't in the list
|
||||||
//add it as blank;
|
//add it as blank;
|
||||||
lstrcat(buffer, TEXT("|"));
|
wcscat_s(buffer, TEXT("|"));
|
||||||
if((BOOL)lParam)
|
if((BOOL)lParam)
|
||||||
{
|
{
|
||||||
lstrcat(buffer, TEXT("PA"));
|
wcscat_s(buffer, TEXT("PA"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lstrcat(buffer, TEXT("UA"));
|
wcscat_s(buffer, TEXT("UA"));
|
||||||
}
|
}
|
||||||
lstrcat(buffer, TEXT("|"));
|
wcscat_s(buffer, TEXT("|"));
|
||||||
SendMessage(BGHS[SelfIndex].hlist1, LB_ADDSTRING, FindResult, reinterpret_cast<LPARAM>(buffer));
|
SendMessage(BGHS[SelfIndex].hlist1, LB_ADDSTRING, FindResult, reinterpret_cast<LPARAM>(buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1653,20 +1653,20 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//now add it
|
//now add it
|
||||||
lstrcat(buffer, TEXT("|"));
|
wcscat_s(buffer, TEXT("|"));
|
||||||
lstrcat(buffer,BGHS[SelfIndex].protect);
|
wcscat_s(buffer,BGHS[SelfIndex].protect);
|
||||||
//determine data type (text,numeric, or boolean)(1,2,3)
|
//determine data type (text,numeric, or boolean)(1,2,3)
|
||||||
//iDataType=DetermineDataType((TCHAR*)lParam);
|
//iDataType=DetermineDataType((TCHAR*)lParam);
|
||||||
|
|
||||||
iDataType = 1;
|
iDataType = 1;
|
||||||
if(iDataType==1){lstrcat(buffer, TEXT("A"));}
|
if(iDataType==1){ wcscat_s(buffer, TEXT("A"));}
|
||||||
if(iDataType==2){lstrcat(buffer, TEXT("N"));}
|
if(iDataType==2){ wcscat_s(buffer, TEXT("N"));}
|
||||||
if(iDataType==3){lstrcat(buffer, TEXT("T"));}
|
if(iDataType==3){ wcscat_s(buffer, TEXT("T"));}
|
||||||
if(iDataType==4){lstrcat(buffer, TEXT("F"));}
|
if(iDataType==4){ wcscat_s(buffer, TEXT("F"));}
|
||||||
if(iDataType==5){lstrcat(buffer, TEXT("G"));}
|
if(iDataType==5){ wcscat_s(buffer, TEXT("G"));}
|
||||||
|
|
||||||
lstrcat(buffer, TEXT("|"));
|
wcscat_s(buffer, TEXT("|"));
|
||||||
lstrcat(buffer, (TCHAR*)lParam);
|
wcscat_s(buffer, (TCHAR*)lParam);
|
||||||
FindResult = static_cast<int32_t>(SendMessage(BGHS[SelfIndex].hlist1, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(buffer)));
|
FindResult = static_cast<int32_t>(SendMessage(BGHS[SelfIndex].hlist1, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(buffer)));
|
||||||
|
|
||||||
if(FindResult==LB_ERR)
|
if(FindResult==LB_ERR)
|
||||||
|
@ -244,7 +244,7 @@ stringVector * FileDialog::doOpenMultiFilesDlg()
|
|||||||
{
|
{
|
||||||
wcscpy_s(fn, _fileName);
|
wcscpy_s(fn, _fileName);
|
||||||
if (fn[lstrlen(fn) - 1] != '\\')
|
if (fn[lstrlen(fn) - 1] != '\\')
|
||||||
lstrcat(fn, TEXT("\\"));
|
wcscat_s(fn, TEXT("\\"));
|
||||||
}
|
}
|
||||||
|
|
||||||
int term = lstrlen(fn);
|
int term = lstrlen(fn);
|
||||||
@ -252,7 +252,7 @@ stringVector * FileDialog::doOpenMultiFilesDlg()
|
|||||||
while (*pFn)
|
while (*pFn)
|
||||||
{
|
{
|
||||||
fn[term] = '\0';
|
fn[term] = '\0';
|
||||||
lstrcat(fn, pFn);
|
wcscat_s(fn, pFn);
|
||||||
_fileNames.push_back(generic_string(fn));
|
_fileNames.push_back(generic_string(fn));
|
||||||
pFn += lstrlen(pFn) + 1;
|
pFn += lstrlen(pFn) + 1;
|
||||||
}
|
}
|
||||||
|
@ -336,7 +336,7 @@ INT_PTR CALLBACK WindowsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
{
|
{
|
||||||
len += lstrlen(readonlyString);
|
len += lstrlen(readonlyString);
|
||||||
if (len <= pLvdi->item.cchTextMax)
|
if (len <= pLvdi->item.cchTextMax)
|
||||||
lstrcat(pLvdi->item.pszText, readonlyString);
|
wcscat_s(pLvdi->item.pszText, pLvdi->item.cchTextMax, readonlyString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (pLvdi->item.iSubItem == 1) // directory
|
else if (pLvdi->item.iSubItem == 1) // directory
|
||||||
|
@ -542,7 +542,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
|||||||
TCHAR str[50] = TEXT("God Damned Exception : ");
|
TCHAR str[50] = TEXT("God Damned Exception : ");
|
||||||
TCHAR code[10];
|
TCHAR code[10];
|
||||||
wsprintf(code, TEXT("%d"), i);
|
wsprintf(code, TEXT("%d"), i);
|
||||||
::MessageBox(Notepad_plus_Window::gNppHWND, lstrcat(str, code), TEXT("Int Exception"), MB_OK);
|
wcscat_s(str, code);
|
||||||
|
::MessageBox(Notepad_plus_Window::gNppHWND, str, TEXT("Int Exception"), MB_OK);
|
||||||
doException(notepad_plus_plus);
|
doException(notepad_plus_plus);
|
||||||
}
|
}
|
||||||
catch (std::runtime_error & ex)
|
catch (std::runtime_error & ex)
|
||||||
|
Loading…
Reference in New Issue
Block a user