From 2aa85006d224ebc6c8a0b35b98a44f3069c243d3 Mon Sep 17 00:00:00 2001 From: Shridhar Kumar <45252729+shriprem@users.noreply.github.com> Date: Mon, 16 May 2022 11:03:09 -0400 Subject: [PATCH] Fix crashes by re-invoking with command line argument "-udl" Fix crashes when re-invoked with -udl command line parameter with more than 7 characters as its value: Serialize _udlName from generic_string to wchar_t _udlName[MAX_PATH]. Fix #11633, close #11681 --- PowerEditor/src/Parameters.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 981efa010..e0ca9a199 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -281,8 +281,7 @@ struct CmdLineParamsDTO intptr_t _pos2go = 0; LangType _langType = L_EXTERNAL; - generic_string _udlName; - + wchar_t _udlName[MAX_PATH]; wchar_t _pluginMessage[MAX_PATH]; static CmdLineParamsDTO FromCmdLineParams(const CmdLineParams& params) @@ -298,9 +297,9 @@ struct CmdLineParamsDTO dto._line2go = params._line2go; dto._column2go = params._column2go; dto._pos2go = params._pos2go; - + dto._langType = params._langType; - dto._udlName = params._udlName; + wcsncpy(dto._udlName, params._udlName.c_str(), MAX_PATH); wcsncpy(dto._pluginMessage, params._pluginMessage.c_str(), MAX_PATH); return dto; }