From b014b965f4e90ab85c6bf4ad9100896b038d1ed7 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 10 May 2012 11:39:54 +0400 Subject: [PATCH] gui/widget/textbox.cpp: fix string access outside of its size --- src/gui/widget/textbox.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 52222713b..bba0b0d63 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -341,11 +341,11 @@ void CTextBox::refreshTextLineArray(void) //TRACE_1(" aktLine : %s\r\n",aktLine.c_str()); //TRACE_1(" aktWidth: %d aktWordWidth:%d\r\n",aktWidth,aktWordWidth); - if( m_cText[pos] == '\n' || + if( ((pos < TextChars) && (m_cText[pos] == '\n')) || loop == false) { // current line ends with an carriage return, make new line - if (m_cText[pos] == '\n') + if ((pos < TextChars) && (m_cText[pos] == '\n')) aktLine.erase(aktLine.size() - 1,1); m_cLineArray.push_back(aktLine); m_nNrOfLines++;