diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index 85d60a6d5..d999c814b 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -529,8 +529,19 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa { case COPYDATA_PARAMS: { - CmdLineParams *cmdLineParam = (CmdLineParams *)pCopyData->lpData; - pNppParam->setCmdlineParam(*cmdLineParam); + CmdLineParams *cmdLineParam = (CmdLineParams *)pCopyData->lpData; // CmdLineParams object from another instance + auto cmdLineParamsSize = static_cast(pCopyData->cbData); // CmdLineParams size from another instance + if (sizeof(CmdLineParams) == cmdLineParamsSize) // make sure the structure is the same + { + pNppParam->setCmdlineParam(*cmdLineParam); + } + else + { +#ifdef DEBUG + printStr(TEXT("sizeof(CmdLineParams) != cmdLineParamsSize\rCmdLineParams is formed by an instance of another version,\rwhereas your CmdLineParams has been modified in this instance.")); +#endif + } + NppGUI nppGui = (NppGUI)pNppParam->getNppGUI(); nppGui._isCmdlineNosessionActivated = cmdLineParam->_isNoSession; break;