Fix invalid memory read in wxMSW wxTextCtrl::GetLineText()
Don't read before the start of the buffer when getting the text of an empty line, this was (correctly) flagged as heap error by address sanitizer.
This commit is contained in:
parent
7dbcbad7c6
commit
ef9161861d
1 changed files with 1 additions and 1 deletions
|
|
@ -1928,7 +1928,7 @@ wxString wxTextCtrl::GetLineText(long lineNo) const
|
|||
|
||||
// remove the '\n' at the end, if any (this is how this function is
|
||||
// supposed to work according to the docs)
|
||||
if ( buf[len - 1] == wxT('\n') )
|
||||
if ( len && buf[len - 1] == wxT('\n') )
|
||||
{
|
||||
len--;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue