[BUG_FIXED] Fix a vulnerability: get full ScinLexer.dll path to avoid hijack.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@657 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2010-08-29 19:50:41 +00:00
parent f602782337
commit 3fa8a89e76

View File

@ -22,7 +22,17 @@
// initialize the static variable
HINSTANCE ScintillaEditView::_hLib = ::LoadLibrary(TEXT("SciLexer.DLL"));
// get full ScinLexer.dll path to avoid hijack
TCHAR * getSciLexerFullPathName(TCHAR * moduleFileName, size_t len){
::GetModuleFileName(NULL, moduleFileName, len);
::PathRemoveFileSpec(moduleFileName);
::PathAppend(moduleFileName, TEXT("SciLexer.dll"));
return moduleFileName;
};
TCHAR moduleFileName[1024];
HINSTANCE ScintillaEditView::_hLib = ::LoadLibrary(getSciLexerFullPathName(moduleFileName, 1024));
int ScintillaEditView::_refCount = 0;
UserDefineDialog ScintillaEditView::_userDefineDlg;