From 02f98ddbe9d49ff67af5364699bc0ca8daaad8ca Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Fri, 17 Aug 2012 17:17:36 +0100 Subject: [PATCH] Ensure input text is null terminated when parsing RichText --- src/interface/RichLabel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/interface/RichLabel.cpp b/src/interface/RichLabel.cpp index 01d35fc11..c93e2172b 100644 --- a/src/interface/RichLabel.cpp +++ b/src/interface/RichLabel.cpp @@ -39,7 +39,7 @@ void RichLabel::updateRichText() displayText = ""; if(textSource.length()) - { + { enum State { ReadText, ReadData, ReadRegion, ReadDataStart }; State state = ReadText; @@ -55,6 +55,7 @@ void RichLabel::updateRichText() int originalTextPos = 0; char * originalText = new char[textSource.length()+1]; std::copy(textSource.begin(), textSource.end(), originalText); + originalText[textSource.length()+1] = 0; int stackPos = -1; RichTextRegion * regionsStack = new RichTextRegion[256];