[BUG_FIXED] (Author: JimD) Fix buffer overflowed problem for function calltip.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1152 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
b363016497
commit
80a672009e
|
@ -138,7 +138,7 @@ bool FunctionCallTip::getCursorFunction()
|
||||||
int endpos = _pEditView->execute(SCI_GETLINEENDPOSITION, line);
|
int endpos = _pEditView->execute(SCI_GETLINEENDPOSITION, line);
|
||||||
int len = endpos - startpos + 3; //also take CRLF in account, even if not there
|
int len = endpos - startpos + 3; //also take CRLF in account, even if not there
|
||||||
int offset = _curPos - startpos; //offset is cursor location, only stuff before cursor has influence
|
int offset = _curPos - startpos; //offset is cursor location, only stuff before cursor has influence
|
||||||
const int maxLen = 128;
|
const int maxLen = 256;
|
||||||
|
|
||||||
if ((offset < 2) || (len >= maxLen))
|
if ((offset < 2) || (len >= maxLen))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1865,7 +1865,7 @@ void ScintillaEditView::getLine(int lineNumber, TCHAR * line, int lineBufferLen)
|
||||||
char *lineA = new char[lineBufferLen];
|
char *lineA = new char[lineBufferLen];
|
||||||
execute(SCI_GETLINE, lineNumber, (LPARAM)lineA);
|
execute(SCI_GETLINE, lineNumber, (LPARAM)lineA);
|
||||||
const TCHAR *lineW = wmc->char2wchar(lineA, cp);
|
const TCHAR *lineW = wmc->char2wchar(lineA, cp);
|
||||||
lstrcpy(line, lineW);
|
lstrcpyn(line, lineW, lineBufferLen);
|
||||||
delete [] lineA;
|
delete [] lineA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1104,7 +1104,7 @@ BOOL CALLBACK DefaultNewDocDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
|
||||||
int selIndex = -1;
|
int selIndex = -1;
|
||||||
generic_string str;
|
generic_string str;
|
||||||
EncodingMapper *em = EncodingMapper::getInstance();
|
EncodingMapper *em = EncodingMapper::getInstance();
|
||||||
for (int i = 0 ; i < sizeof(encodings)/sizeof(int) ; ++i)
|
for (size_t i = 0, encodingArraySize = sizeof(encodings)/sizeof(int) ; i < encodingArraySize ; ++i)
|
||||||
{
|
{
|
||||||
int cmdID = em->getIndexFromEncoding(encodings[i]);
|
int cmdID = em->getIndexFromEncoding(encodings[i]);
|
||||||
if (cmdID != -1)
|
if (cmdID != -1)
|
||||||
|
|
Loading…
Reference in New Issue