From ff8c9ab6dc2e5cbc07f8395aad3f2de5f6eec5f9 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 16 Dec 2018 19:48:34 +0100 Subject: [PATCH] Properly terminate source file data. --- server/TracyView.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 193ccab0..14c85846 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -395,9 +395,10 @@ void View::SetTextEditorFile( const char* fileName, int line ) fseek( f, 0, SEEK_END ); const auto sz = ftell( f ); fseek( f, 0, SEEK_SET ); - auto data = new char[sz]; + auto data = new char[sz+1]; fread( data, 1, sz, f ); fclose( f ); + data[sz] = '\0'; m_textEditor->SetText( data ); delete[] data; }