diff --git a/components/openmw-mp/Base/BasePlayer.hpp b/components/openmw-mp/Base/BasePlayer.hpp index e5e2d1062..4b2c8dac1 100644 --- a/components/openmw-mp/Base/BasePlayer.hpp +++ b/components/openmw-mp/Base/BasePlayer.hpp @@ -233,15 +233,15 @@ namespace mwmp // Track only the indexes of the attributes that have been changed, // with the attribute values themselves being stored in creatureStats.mAttributes - std::vector attributeIndexChanges; + std::vector attributeIndexChanges; // Track only the indexes of the skills that have been changed, // with the skill values themselves being stored in npcStats.mSkills - std::vector skillIndexChanges; + std::vector skillIndexChanges; // Track only the indexes of the dynamic states that have been changed, // with the dynamicStats themselves being stored in creatureStats.mDynamic - std::vector statsDynamicIndexChanges; + std::vector statsDynamicIndexChanges; // Track only the indexes of the equipment items that have been changed, // with the items themselves being stored in equipmentItems diff --git a/components/openmw-mp/Packets/Player/PacketPlayerAttribute.cpp b/components/openmw-mp/Packets/Player/PacketPlayerAttribute.cpp index 391fcf10e..b0cbad075 100644 --- a/components/openmw-mp/Packets/Player/PacketPlayerAttribute.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerAttribute.cpp @@ -39,6 +39,12 @@ void PacketPlayerAttribute::Packet(RakNet::BitStream *bs, bool send) { RW(attributeIndex, send); + if (attributeIndex >= 8) + { + packetValid = false; + return; + } + RW(player->creatureStats.mAttributes[attributeIndex], send); RW(player->npcStats.mSkillIncrease[attributeIndex], send); } diff --git a/components/openmw-mp/Packets/Player/PacketPlayerSkill.cpp b/components/openmw-mp/Packets/Player/PacketPlayerSkill.cpp index 0978e1797..b44eb9a59 100644 --- a/components/openmw-mp/Packets/Player/PacketPlayerSkill.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerSkill.cpp @@ -38,6 +38,11 @@ void PacketPlayerSkill::Packet(RakNet::BitStream *bs, bool send) for (auto &&skillId : player->skillIndexChanges) { RW(skillId, send); + if (skillId >= 27) + { + packetValid = false; + return; + } RW(player->npcStats.mSkills[skillId], send); } } diff --git a/components/openmw-mp/Packets/Player/PacketPlayerStatsDynamic.cpp b/components/openmw-mp/Packets/Player/PacketPlayerStatsDynamic.cpp index b83a75e9c..826011d28 100644 --- a/components/openmw-mp/Packets/Player/PacketPlayerStatsDynamic.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerStatsDynamic.cpp @@ -37,7 +37,11 @@ void PacketPlayerStatsDynamic::Packet(RakNet::BitStream *bs, bool send) for (auto &&statsDynamicIndex : player->statsDynamicIndexChanges) { RW(statsDynamicIndex, send); - + if (statsDynamicIndex >= 3) + { + packetValid = false; + return; + } RW(player->creatureStats.mDynamic[statsDynamicIndex], send); } }