LibGUI: Fix null-termination of TextDocumentLine

This commit is contained in:
Tibor Nagy 2020-03-08 00:57:56 +01:00 committed by Andreas Kling
parent 0c7058aaa0
commit 0d17e3bfa6
Notes: sideshowbarker 2024-07-19 08:50:58 +09:00

View file

@ -118,7 +118,8 @@ void TextDocumentLine::set_text(TextDocument& document, const StringView& text)
return;
}
m_text.resize((int)text.length() + 1);
memcpy(m_text.data(), text.characters_without_null_termination(), text.length() + 1);
memcpy(m_text.data(), text.characters_without_null_termination(), text.length());
m_text.last() = 0;
document.update_views({});
}