From c30074be66ae166b79ed9e4778b458d074669e57 Mon Sep 17 00:00:00 2001 From: Vayle <76063792+Valorith@users.noreply.github.com> Date: Sat, 22 Jul 2023 10:20:22 -0400 Subject: [PATCH] [Crash Fix] Guard against Spells:MaxTotalSlotsPET being set above client allowed maximum. (#3507) * Guard against MaxTotalSlotsPET being set too high This prevents a crash from MaxTotalSlotsPET being set too high. * Tweak --- zone/zonedb.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 995fa0439..cf3542729 100755 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3303,7 +3303,8 @@ void ZoneDatabase::SavePetInfo(Client *client) // build pet buffs into struct int pet_buff_count = 0; - int max_slots = RuleI(Spells, MaxTotalSlotsPET); + // Guard against setting the maximum pet slots above the client allowed maximum. + int max_slots = RuleI(Spells, MaxTotalSlotsPET) > PET_BUFF_COUNT ? PET_BUFF_COUNT : RuleI(Spells, MaxTotalSlotsPET); // count pet buffs for (int index = 0; index < max_slots; index++) {