From 1c4166ce469fa2c52600d6cfe941c94c153c255d 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 892e575d8..8a55e3e48 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);