mirror of
https://github.com/DarkflameUniverse/DarkflameServer
synced 2024-08-30 18:43:58 +00:00
Prevent integer underflow in item removal
Previously, the only check that the user wasn't trashing more items than they had was clientsided, and this could be bypassed by contacting the server to remove items via a console or the like, and then trashing them before the server could respond, resulting in the count for the items being less than iStackCount. This check prevents that underflow.
This commit is contained in:
parent
e92cdc4f14
commit
59ec28a5a4
@ -5441,7 +5441,7 @@ void GameMessages::HandleRemoveItemFromInventory(RakNet::BitStream* inStream, En
|
||||
}
|
||||
}
|
||||
|
||||
item->SetCount(item->GetCount() - iStackCount, true);
|
||||
item->SetCount(item->GetCount() - std::min<uint32_t>(item->GetCount(), iStackCount), true);
|
||||
EntityManager::Instance()->SerializeEntity(entity);
|
||||
|
||||
auto* missionComponent = entity->GetComponent<MissionComponent>();
|
||||
|
Loading…
Reference in New Issue
Block a user