From 40978cd8332a9ff80fa0339aa072553e0c71bb9d Mon Sep 17 00:00:00 2001 From: Ivan Date: Thu, 28 Nov 2024 05:31:39 +0400 Subject: [PATCH] tmppanel: fix #2518 (missing null-terminator) + minor optimization --- tmppanel/src/TmpPanel.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tmppanel/src/TmpPanel.cpp b/tmppanel/src/TmpPanel.cpp index 36bd0df16..88fc277a6 100644 --- a/tmppanel/src/TmpPanel.cpp +++ b/tmppanel/src/TmpPanel.cpp @@ -95,11 +95,15 @@ SHAREDSYMBOL HANDLE WINAPI EXP_NAME(OpenPlugin)(int OpenFrom, INT_PTR Item) StrBuf tmpTMP(k + 1); TCHAR *TMP = tmpTMP; - lstrcpyn(TMP, argv - k, k + 1); + lstrcpyn(TMP, argv - k, k); + TMP[k] = L'\0'; - for (int i = 0; i < OPT_COUNT; i++) - if (lstrcmpi(TMP + 1, ParamsStr[i]) == 0) + for (int i = 0; i < OPT_COUNT; i++) { + if (lstrcmpi(TMP + 1, ParamsStr[i]) == 0) { *(int *)ParamsOpt[i] = *TMP == _T('+'); + break; + } + } if (*(TMP + 1) >= _T('0') && *(TMP + 1) <= _T('9')) CurrentCommonPanel = *(TMP + 1) - _T('0');