From 4d58027f172e8d01b3fd2340a018eaa38a06c74a Mon Sep 17 00:00:00 2001 From: Don HO Date: Fri, 22 Mar 2019 20:08:31 +0100 Subject: [PATCH] [EU-FOSSA] Add an enhancement to prevent from the eventual crash. --- PowerEditor/src/NppIO.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/PowerEditor/src/NppIO.cpp b/PowerEditor/src/NppIO.cpp index a2d023b6..0c0b8ab8 100644 --- a/PowerEditor/src/NppIO.cpp +++ b/PowerEditor/src/NppIO.cpp @@ -218,7 +218,6 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive, { if (!PathFileExists(longFileName) && !globbing) { - TCHAR str2display[MAX_PATH*2]; generic_string longFileDir(longFileName); PathRemoveFileSpec(longFileDir); @@ -254,8 +253,12 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive, } else { - wsprintf(str2display, TEXT("\"%s\" cannot be opened:\nFolder \"%s\" doesn't exist."), longFileName, longFileDir.c_str()); - ::MessageBox(_pPublicInterface->getHSelf(), str2display, TEXT("Cannot open file"), MB_OK); + generic_string str2display = TEXT("\""); + str2display += longFileName; + str2display += TEXT("\" cannot be opened:\nFolder \""); + str2display += longFileDir; + str2display += TEXT("\" doesn't exist."); + ::MessageBox(_pPublicInterface->getHSelf(), str2display.c_str(), TEXT("Cannot open file"), MB_OK); } if (!isCreateFileSuccessful)