+fix: some missing Path_Sanitize() calls

This commit is contained in:
METANEOCORTEX\Kotti 2024-05-27 19:57:49 +02:00
parent 2b99b48fc9
commit efd40a295c
3 changed files with 11 additions and 1 deletions

View File

@ -1523,6 +1523,7 @@ CASE_WM_CTLCOLOR_SET:
wchar_t* const args_buf = StrgWriteAccessBuf(hargs_str, CMDLN_LENGTH_LIMIT);
if (GetDlgItemText(hwnd, IDC_COMMANDLINE, file_buf, (int)Path_GetBufCount(hfile_pth))) {
Path_Sanitize(hfile_pth);
bool bQuickExit = false;
@ -2628,6 +2629,7 @@ CASE_WM_CTLCOLOR_SET:
ListView_GetItem(hwndLV, &lvi);
Path_Sanitize(hFilePath);
Path_UnQuoteSpaces(hFilePath);
Path_AbsoluteFromApp(hFilePath, true);
@ -5079,8 +5081,11 @@ void DialogGrepWin(HWND hwnd, LPCWSTR searchPattern)
if (lngIdx >= 0) {
IniSectionGetString(globalSection, L"languagefile", grepWinLangResName[lngIdx].filename, wchLngPathBuf, Path_GetBufCount(hLngFilePath));
IniSectionSetString(globalSection, L"languagefile", wchLngPathBuf);
} else {
Path_Sanitize(hLngFilePath);
}
else {
IniSectionGetString(globalSection, L"languagefile", L"", wchLngPathBuf, Path_GetBufCount(hLngFilePath));
Path_Sanitize(hLngFilePath);
if (Path_IsEmpty(hLngFilePath)) {
IniSectionDelete(globalSection, L"languagefile", false);
}

View File

@ -813,6 +813,7 @@ bool DirList_SelectItem(HWND hwnd,LPCWSTR lpszDisplayName,LPCWSTR lpszFullPath)
DirList_GetItem(hwnd,i,&dli);
GetShortPathNameW(dli.pthFileName, dli.pthFileName, (DWORD)Path_GetBufCount(hpthFileName));
Path_Sanitize(hpthFileName);
if (StringCchCompareXI(dli.pthFileName, Path_Get(hshort_pth)) == 0) {
ListView_SetItemState(hwnd,i,LVIS_FLAGS,LVIS_FLAGS);

View File

@ -3759,6 +3759,7 @@ LRESULT MsgDropFiles(HWND hwnd, WPARAM wParam, LPARAM lParam)
for (UINT i = 0; i < cnt; ++i) {
WININFO wi = GetMyWindowPlacement(hwnd, NULL, (vkCtrlDown ? (offset * (i + 1)) : 0), bFullVisible);
DragQueryFileW(hDrop, i, drop_buf, (UINT)Path_GetBufCount(hdrop_pth));
Path_Sanitize(hdrop_pth);
_OnDropOneFile(hwnd, hdrop_pth, (((0 == i) && !IsKeyDown(VK_CONTROL)) ? NULL : &wi));
}
@ -7976,9 +7977,11 @@ void HandleDWellStartEnd(const DocPos position, const UINT uid)
LPWSTR const url_buf = Path_WriteAccessBuf(hurl_pth, cchPath);
if (FAILED(PathCreateFromUrlW(wchUrl, url_buf, &cchPath, 0))) {
Path_Sanitize(hurl_pth);
const char *p = &pUrlBegin[CONSTSTRGLEN("file://")];
while (p && (*p == '/')) { ++p; }
StringCchCopyN(url_buf, Path_GetBufCount(hurl_pth), wchUrl, cchUrl); // no op
Path_Sanitize(hurl_pth);
cchPath = (DWORD)Path_GetLength(hurl_pth);
}
Path_Sanitize(hurl_pth);
@ -9131,6 +9134,7 @@ static LRESULT _MsgNotifyFromEdit(HWND hwnd, const SCNotification* const scn)
HPATHL hfile_pth = Path_Allocate(NULL);
wchar_t* const file_buf = Path_WriteAccessBuf(hfile_pth, STRINGW_MAX_URL_LENGTH);
int const cnt = MultiByteToWideChar(CP_UTF8, 0, scn->text, -1, file_buf, (int)Path_GetBufCount(hfile_pth));
Path_Sanitize(hfile_pth);
LRESULT const result = (cnt > 0) ? _OnDropOneFile(hwnd, hfile_pth, NULL) : FALSE;
Path_Release(hfile_pth);
return result;