[EU-FOSSA] Fix stack overflow in XML Parsing
This commit is contained in:
parent
b9ce848881
commit
ccdf7d8d8b
@ -978,7 +978,7 @@ int Notepad_plus::getHtmlXmlEncoding(const TCHAR *fileName) const
|
|||||||
_invisibleEditView.execute(SCI_APPENDTEXT, lenFile, reinterpret_cast<LPARAM>(data));
|
_invisibleEditView.execute(SCI_APPENDTEXT, lenFile, reinterpret_cast<LPARAM>(data));
|
||||||
|
|
||||||
const char *encodingAliasRegExpr = "[a-zA-Z0-9_-]+";
|
const char *encodingAliasRegExpr = "[a-zA-Z0-9_-]+";
|
||||||
|
const int encodingStrLen = 128;
|
||||||
if (langT == L_XML)
|
if (langT == L_XML)
|
||||||
{
|
{
|
||||||
// find encoding by RegExpr
|
// find encoding by RegExpr
|
||||||
@ -1005,7 +1005,13 @@ int Notepad_plus::getHtmlXmlEncoding(const TCHAR *fileName) const
|
|||||||
startPos = int(_invisibleEditView.execute(SCI_GETTARGETSTART));
|
startPos = int(_invisibleEditView.execute(SCI_GETTARGETSTART));
|
||||||
endPos = _invisibleEditView.execute(SCI_GETTARGETEND);
|
endPos = _invisibleEditView.execute(SCI_GETTARGETEND);
|
||||||
|
|
||||||
char encodingStr[128];
|
int len = endPos - startPos;
|
||||||
|
if (len >= encodingStrLen)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char encodingStr[encodingStrLen];
|
||||||
_invisibleEditView.getText(encodingStr, startPos, endPos);
|
_invisibleEditView.getText(encodingStr, startPos, endPos);
|
||||||
|
|
||||||
EncodingMapper *em = EncodingMapper::getInstance();
|
EncodingMapper *em = EncodingMapper::getInstance();
|
||||||
@ -1043,7 +1049,13 @@ int Notepad_plus::getHtmlXmlEncoding(const TCHAR *fileName) const
|
|||||||
startPos = int(_invisibleEditView.execute(SCI_GETTARGETSTART));
|
startPos = int(_invisibleEditView.execute(SCI_GETTARGETSTART));
|
||||||
endPos = _invisibleEditView.execute(SCI_GETTARGETEND);
|
endPos = _invisibleEditView.execute(SCI_GETTARGETEND);
|
||||||
|
|
||||||
char encodingStr[128];
|
int len = endPos - startPos;
|
||||||
|
if (len >= encodingStrLen)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char encodingStr[encodingStrLen];
|
||||||
_invisibleEditView.getText(encodingStr, startPos, endPos);
|
_invisibleEditView.getText(encodingStr, startPos, endPos);
|
||||||
|
|
||||||
EncodingMapper *em = EncodingMapper::getInstance();
|
EncodingMapper *em = EncodingMapper::getInstance();
|
||||||
|
Loading…
Reference in New Issue
Block a user