antihacks: Protect per-player detached inventory actions
* backported https://github.com/minetest/minetest/pull/10341 Unfortunately also requires invhack mods to implement workarounds, but they seem to already be doing this.
This commit is contained in:
parent
4e1b1d0364
commit
a7b542c074
@ -935,13 +935,19 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt)
|
|||||||
setInventoryModified(ma->from_inv, false);
|
setInventoryModified(ma->from_inv, false);
|
||||||
setInventoryModified(ma->to_inv, false);
|
setInventoryModified(ma->to_inv, false);
|
||||||
|
|
||||||
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…
x
Reference in New Issue
Block a user