Merge pull request #504 from NinjaOfLU/fix-item-removal-underflow

Prevent integer underflow in item removal
This commit is contained in:
David Markowitz 2022-04-19 15:21:28 -07:00 committed by GitHub
commit c489132f59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5433,6 +5433,8 @@ void GameMessages::HandleRemoveItemFromInventory(RakNet::BitStream* inStream, En
return; return;
} }
iStackCount = std::min<uint32_t>(item->GetCount(), iStackCount);
if (bConfirmed) { if (bConfirmed) {
for (auto i = 0; i < iStackCount; ++i) { for (auto i = 0; i < iStackCount; ++i) {
if (eInvType == eInventoryType::MODELS) if (eInvType == eInventoryType::MODELS)