Skip to content

Commit

Permalink
fix security check issues
Browse files Browse the repository at this point in the history
  • Loading branch information
stefankueng committed Nov 13, 2024
1 parent d0a85ad commit 64015b0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Commands/CmdFindReplace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2123,7 +2123,7 @@ void CFindReplaceDlg::SearchThread(int id, const std::wstring& searchPath, const
size_t resultSizeBefore = m_pendingSearchResults.size();
SearchDocument(*searchWnd.get(), DocID(), doc, searchFor, flags, exSearchFlags,
m_pendingSearchResults, m_pendingFoundPaths);
if (m_pendingSearchResults.size() - resultSizeBefore > 0)
if (m_pendingSearchResults.size() - resultSizeBefore != 0)
m_pendingFoundPaths.push_back(std::move(path));
NewData(timeOfLastProgressUpdate, false);
if (m_foundSize >= m_maxSearchResults)
Expand Down
6 changes: 3 additions & 3 deletions src/Commands/CmdSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ void CCmdSessionLoad::OnClose()
settings.SetInt64(sessionSection(), CStringUtils::Format(L"undocurrentaction%d", index).c_str(), pos.m_undoData.m_currentAction);
settings.SetInt64(sessionSection(), CStringUtils::Format(L"undosavepoint%d", index).c_str(), pos.m_undoData.m_savePoint);
settings.SetInt64(sessionSection(), CStringUtils::Format(L"undotentative%d", index).c_str(), pos.m_undoData.m_tentative);
for (size_t undoIdx = 0; undoIdx < pos.m_undoData.m_actions.size(); ++undoIdx)
for (int undoIdx = 0; undoIdx < static_cast<int>(pos.m_undoData.m_actions.size()); ++undoIdx)
{
auto& action = pos.m_undoData.m_actions[undoIdx];
settings.SetInt64(sessionSection(), CStringUtils::Format(L"undoactiontype%d_%d", index, undoIdx).c_str(), action.m_type);
Expand Down Expand Up @@ -301,14 +301,14 @@ void CCmdSessionLoad::RestoreSavedSession() const
{
stringtok(pos.m_lineStateVector, folds, true, L";", false);
}
auto numUndoActions = static_cast<size_t>(settings.GetInt64(sessionSection(), CStringUtils::Format(L"undonumactions%d", fileNum).c_str(), 0));
auto numUndoActions = static_cast<int>(settings.GetInt64(sessionSection(), CStringUtils::Format(L"undonumactions%d", fileNum).c_str(), 0));
if (numUndoActions)
{
CUndoData undoData;
undoData.m_currentAction = static_cast<int>(settings.GetInt64(sessionSection(), CStringUtils::Format(L"undocurrentaction%d", fileNum).c_str(), 0));
undoData.m_savePoint = static_cast<int>(settings.GetInt64(sessionSection(), CStringUtils::Format(L"undosavepoint%d", fileNum).c_str(), 0));
undoData.m_tentative = static_cast<int>(settings.GetInt64(sessionSection(), CStringUtils::Format(L"undotentative%d", fileNum).c_str(), 0));
for (size_t undoIdx = 0; undoIdx < numUndoActions; ++undoIdx)
for (int undoIdx = 0; undoIdx < numUndoActions; ++undoIdx)
{
CUndoAction action;
action.m_type = static_cast<int>(settings.GetInt64(sessionSection(), CStringUtils::Format(L"undoactiontype%d_%d", fileNum, undoIdx).c_str(), 0));
Expand Down
5 changes: 3 additions & 2 deletions src/SettingsDlg.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of BowPad.
//
// Copyright (C) 2021-2022 - Stefan Kueng
// Copyright (C) 2021-2022, 2024 - Stefan Kueng
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -274,7 +274,8 @@ void CSettingsDlg::InitSettingsList()
case SettingType::Number:
{
auto val = CIniSettings::Instance().GetInt64(setting.section.c_str(), setting.key.c_str(), setting.def.l);
ListView_SetItemText(hListControl, index, 0, const_cast<LPWSTR>(std::to_wstring(val).c_str()));
auto valStr = std::to_wstring(val);
ListView_SetItemText(hListControl, index, 0, const_cast<LPWSTR>(valStr.c_str()));
}
break;
case SettingType::String:
Expand Down

0 comments on commit 64015b0

Please sign in to comment.