From e02da5ba4ac71bddf04255ea76509aeebfb3ef2b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 24 Jan 2026 03:23:51 +0000 Subject: [PATCH] Harden inspect message handling Co-authored-by: Valorith <76063792+Valorith@users.noreply.github.com> --- common/shareddb.cpp | 2 +- libs/perlbind/include/perlbind/function.h | 2 +- zone/client_packet.cpp | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 0ef0cbe4e..97807ef39 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1853,7 +1853,7 @@ void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMes return; } - memcpy(s, e.inspect_message.c_str(), sizeof(InspectMessage_Struct)); + strn0cpy(s->text, e.inspect_message.c_str(), sizeof(s->text)); } void SharedDatabase::SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* s) diff --git a/libs/perlbind/include/perlbind/function.h b/libs/perlbind/include/perlbind/function.h index 2d4455a9b..89f26fec9 100644 --- a/libs/perlbind/include/perlbind/function.h +++ b/libs/perlbind/include/perlbind/function.h @@ -74,7 +74,7 @@ struct function : public function_base, function_traits std::string get_signature() const override { - return util::type_name::str(); + return util::type_name::str() + "(" + util::type_name::str() + ")"; }; bool is_compatible(xsub_stack& stack) const override diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 231d442e1..e14cd85ef 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9062,10 +9062,10 @@ void Client::Handle_OP_InspectAnswer(const EQApplicationPacket *app) } } - auto message = (InspectMessage_Struct *) insr->text; - auto inspect_message = GetInspectMessage(); + auto message = reinterpret_cast(insr->text); + auto &inspect_message = GetInspectMessage(); - memcpy(&inspect_message, message, sizeof(InspectMessage_Struct)); + strn0cpy(inspect_message.text, message->text, sizeof(inspect_message.text)); database.SaveCharacterInspectMessage(CharacterID(), &inspect_message); if ( @@ -9084,9 +9084,9 @@ void Client::Handle_OP_InspectMessageUpdate(const EQApplicationPacket *app) return; } - InspectMessage_Struct* newmessage = (InspectMessage_Struct*)app->pBuffer; - InspectMessage_Struct& playermessage = GetInspectMessage(); - memcpy(&playermessage, newmessage, sizeof(InspectMessage_Struct)); + auto *newmessage = reinterpret_cast(app->pBuffer); + auto &playermessage = GetInspectMessage(); + strn0cpy(playermessage.text, newmessage->text, sizeof(playermessage.text)); database.SaveCharacterInspectMessage(CharacterID(), &playermessage); }