From 25dc50deef4d72f2ff240f61f28a95e8fbe246c8 Mon Sep 17 00:00:00 2001 From: KPhoenix Date: Sat, 6 Apr 2024 16:08:34 -0400 Subject: [PATCH] fix hp validation --- Source/pack.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/pack.cpp b/Source/pack.cpp index c7aac7398..b9f2e7085 100644 --- a/Source/pack.cpp +++ b/Source/pack.cpp @@ -553,7 +553,8 @@ bool UnPackNetPlayer(const PlayerNetPack &packed, Player &player) int32_t baseHpMax = SDL_SwapLE32(packed.pMaxHPBase); int32_t baseHp = SDL_SwapLE32(packed.pHPBase); - ValidateFields(baseHp, baseHpMax, baseHp >= 0 && baseHp <= baseHpMax); + int32_t hpMax = SDL_SwapLE32(packed.pMaxHP); + ValidateFields(baseHp, baseHpMax, baseHp >= (baseHpMax - hpMax) && baseHp <= baseHpMax); int32_t baseManaMax = SDL_SwapLE32(packed.pMaxManaBase); int32_t baseMana = SDL_SwapLE32(packed.pManaBase);