Harden inspect message handling

Co-authored-by: Valorith <76063792+Valorith@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-01-24 03:23:51 +00:00
parent 58e007a50f
commit e02da5ba4a
3 changed files with 8 additions and 8 deletions

View File

@ -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)

View File

@ -74,7 +74,7 @@ struct function : public function_base, function_traits<T>
std::string get_signature() const override
{
return util::type_name<target_t>::str();
return util::type_name<return_t>::str() + "(" + util::type_name<typename function::sig_t>::str() + ")";
};
bool is_compatible(xsub_stack& stack) const override

View File

@ -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<InspectMessage_Struct *>(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<const InspectMessage_Struct *>(app->pBuffer);
auto &playermessage = GetInspectMessage();
strn0cpy(playermessage.text, newmessage->text, sizeof(playermessage.text));
database.SaveCharacterInspectMessage(CharacterID(), &playermessage);
}