Enhance CMake configuration and improve string safety in source files

- Updated CMakeLists.txt to silence C++23 deprecation warnings and added definitions for intrinsic int128 support.
- Modified GitHub Actions workflow to handle missing asset directories gracefully and ensure correct versioning in Info.plist.
- Refactored string handling in multiple source files to use std::memcpy for safer string copying, preventing potential buffer overflows.
- Improved font loading logic and ensured consistent handling of theme properties in the editor.
This commit is contained in:
scawful
2025-09-27 22:03:03 -04:00
parent 332f050cf6
commit 660c3fd46f
8 changed files with 98 additions and 29 deletions

View File

@@ -1,5 +1,6 @@
#include "editor_manager.h"
#include <algorithm>
#include <chrono>
#include <cstring>
@@ -2254,8 +2255,11 @@ void EditorManager::DrawSessionSwitcher() {
ImGui::SameLine();
if (ImGui::Button("Rename")) {
session_to_rename_ = i;
std::strncpy(session_rename_buffer_, session.GetDisplayName().c_str(), sizeof(session_rename_buffer_) - 1);
session_rename_buffer_[sizeof(session_rename_buffer_) - 1] = '\0';
// Safe string copy with bounds checking
const std::string& name = session.GetDisplayName();
size_t copy_len = std::min(name.length(), sizeof(session_rename_buffer_) - 1);
std::memcpy(session_rename_buffer_, name.c_str(), copy_len);
session_rename_buffer_[copy_len] = '\0';
show_session_rename_dialog_ = true;
}
@@ -2431,8 +2435,11 @@ void EditorManager::DrawSessionManager() {
ImGui::SameLine();
if (ImGui::Button("Rename")) {
session_to_rename_ = i;
std::strncpy(session_rename_buffer_, session.GetDisplayName().c_str(), sizeof(session_rename_buffer_) - 1);
session_rename_buffer_[sizeof(session_rename_buffer_) - 1] = '\0';
// Safe string copy with bounds checking
const std::string& name = session.GetDisplayName();
size_t copy_len = std::min(name.length(), sizeof(session_rename_buffer_) - 1);
std::memcpy(session_rename_buffer_, name.c_str(), copy_len);
session_rename_buffer_[copy_len] = '\0';
show_session_rename_dialog_ = true;
}