mirror of
https://github.com/yuanyuanxiang/SimpleRemoter.git
synced 2026-01-31 11:46:14 +08:00
Fix: Dangling pointer when assigning _TR/_L result to LPCTSTR
_TR() and _L() return temporary CString objects. Assigning them directly to raw pointer fields (m_ofn.lpstrTitle) causes use-after-free. Use local CString variable to extend lifetime.
This commit is contained in:
@@ -4999,7 +4999,8 @@ void CMy2015RemoteDlg::OnChangeLang()
|
||||
void CMy2015RemoteDlg::OnChooseLangDir()
|
||||
{
|
||||
CFolderPickerDialog folderDlg(THIS_CFG.GetStr("settings", "LangDir", "./lang").c_str(), NULL, this, 0);
|
||||
folderDlg.m_ofn.lpstrTitle = _TR("请选择目录");
|
||||
CString strTitle = _TR("请选择目录");
|
||||
folderDlg.m_ofn.lpstrTitle = strTitle;
|
||||
if (folderDlg.DoModal() == IDOK)
|
||||
{
|
||||
CString folderPath = folderDlg.GetPathName();
|
||||
|
||||
@@ -1643,7 +1643,8 @@ void CMachineDlg::ShowHostsList_menu()
|
||||
LPBYTE lpBuffer = NULL;
|
||||
CFileDialog dlg(TRUE, _T("*.txt"), NULL, OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY,
|
||||
_T("图片文件(*.txt;*.txt)|*.txt;*.txt| All Files (*.*) |*.*||"), NULL);
|
||||
dlg.m_ofn.lpstrTitle = _L(_T("选择文件"));
|
||||
CString strTitle = _L(_T("选择文件"));
|
||||
dlg.m_ofn.lpstrTitle = strTitle;
|
||||
|
||||
if (dlg.DoModal() != IDOK)
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user