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:
@@ -1,5 +1,6 @@
|
||||
#include "dungeon_object_selector.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <cstring>
|
||||
|
||||
@@ -1046,8 +1047,10 @@ void DungeonObjectSelector::DrawCompactPropertiesEditor() {
|
||||
static int music_id = 0;
|
||||
|
||||
// Copy current values
|
||||
std::strncpy(room_name, properties.name.c_str(), sizeof(room_name) - 1);
|
||||
room_name[sizeof(room_name) - 1] = '\0';
|
||||
// Safe string copy with bounds checking
|
||||
size_t name_len = std::min(properties.name.length(), sizeof(room_name) - 1);
|
||||
std::memcpy(room_name, properties.name.c_str(), name_len);
|
||||
room_name[name_len] = '\0';
|
||||
dungeon_id = properties.dungeon_id;
|
||||
floor_level = properties.floor_level;
|
||||
is_boss_room = properties.is_boss_room;
|
||||
|
||||
Reference in New Issue
Block a user