Browse Source

LibGUI: Fix null-termination of TextDocumentLine

Tibor Nagy 5 years ago
parent
commit
0d17e3bfa6
1 changed files with 2 additions and 1 deletions
  1. 2 1
      Libraries/LibGUI/TextDocument.cpp

+ 2 - 1
Libraries/LibGUI/TextDocument.cpp

@@ -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({});
 }