mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-13 20:04:01 +02:00
Ensure input text is null terminated when parsing RichText
This commit is contained in:
@@ -39,7 +39,7 @@ void RichLabel::updateRichText()
|
|||||||
displayText = "";
|
displayText = "";
|
||||||
|
|
||||||
if(textSource.length())
|
if(textSource.length())
|
||||||
{
|
{
|
||||||
|
|
||||||
enum State { ReadText, ReadData, ReadRegion, ReadDataStart };
|
enum State { ReadText, ReadData, ReadRegion, ReadDataStart };
|
||||||
State state = ReadText;
|
State state = ReadText;
|
||||||
@@ -55,6 +55,7 @@ void RichLabel::updateRichText()
|
|||||||
int originalTextPos = 0;
|
int originalTextPos = 0;
|
||||||
char * originalText = new char[textSource.length()+1];
|
char * originalText = new char[textSource.length()+1];
|
||||||
std::copy(textSource.begin(), textSource.end(), originalText);
|
std::copy(textSource.begin(), textSource.end(), originalText);
|
||||||
|
originalText[textSource.length()+1] = 0;
|
||||||
|
|
||||||
int stackPos = -1;
|
int stackPos = -1;
|
||||||
RichTextRegion * regionsStack = new RichTextRegion[256];
|
RichTextRegion * regionsStack = new RichTextRegion[256];
|
||||||
|
Reference in New Issue
Block a user