From c9511b931531bcd777c3b172af36af144f39bdf0 Mon Sep 17 00:00:00 2001 From: Philipp Marek Date: Thu, 16 Apr 2020 11:20:06 +0000 Subject: [PATCH] Fix segfault when history file can't be opened `m_Line` must be initialized, even if the file isn't readable (because the current user has no access rights). Fixes a segfault. --- src/utils/utility.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/utility.cpp b/src/utils/utility.cpp index 545e3f3e..a2e185b2 100644 --- a/src/utils/utility.cpp +++ b/src/utils/utility.cpp @@ -916,6 +916,7 @@ int mc_TerminalInput::LoadDataFromLog(const char* fileName) int err; int start,pos; + strcpy(m_Line,""); fHan=open(fileName,_O_BINARY | O_RDONLY); if(fHan<0) { @@ -958,7 +959,6 @@ int mc_TerminalInput::LoadDataFromLog(const char* fileName) pos++; } - strcpy(m_Line,""); start=pos+24; while(start