mirror of
https://github.com/minetest/minetest.git
synced 2024-12-24 23:22:24 +01:00
Prevent players accessing inventories of other players (#10341)
This commit is contained in:
parent
d28f1b0170
commit
3693b6871e
@ -630,13 +630,19 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt)
|
|||||||
if (ma->from_inv != ma->to_inv)
|
if (ma->from_inv != ma->to_inv)
|
||||||
m_inventory_mgr->setInventoryModified(ma->to_inv);
|
m_inventory_mgr->setInventoryModified(ma->to_inv);
|
||||||
|
|
||||||
bool from_inv_is_current_player =
|
bool from_inv_is_current_player = false;
|
||||||
(ma->from_inv.type == InventoryLocation::PLAYER) &&
|
if (ma->from_inv.type == InventoryLocation::PLAYER) {
|
||||||
(ma->from_inv.name == player->getName());
|
if (ma->from_inv.name != player->getName())
|
||||||
|
return;
|
||||||
|
from_inv_is_current_player = true;
|
||||||
|
}
|
||||||
|
|
||||||
bool to_inv_is_current_player =
|
bool to_inv_is_current_player = false;
|
||||||
(ma->to_inv.type == InventoryLocation::PLAYER) &&
|
if (ma->to_inv.type == InventoryLocation::PLAYER) {
|
||||||
(ma->to_inv.name == player->getName());
|
if (ma->to_inv.name != player->getName())
|
||||||
|
return;
|
||||||
|
to_inv_is_current_player = true;
|
||||||
|
}
|
||||||
|
|
||||||
InventoryLocation *remote = from_inv_is_current_player ?
|
InventoryLocation *remote = from_inv_is_current_player ?
|
||||||
&ma->to_inv : &ma->from_inv;
|
&ma->to_inv : &ma->from_inv;
|
||||||
|
Loading…
Reference in New Issue
Block a user