@@ -636,7 +636,7 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt)
636
636
return ;
637
637
from_inv_is_current_player = true ;
638
638
}
639
-
639
+
640
640
bool to_inv_is_current_player = false ;
641
641
if (ma->to_inv .type == InventoryLocation::PLAYER) {
642
642
if (ma->to_inv .name != player->getName ())
@@ -869,6 +869,15 @@ void Server::handleCommand_PlayerItem(NetworkPacket* pkt)
869
869
870
870
*pkt >> item;
871
871
872
+ if (item >= player->getHotbarItemcount ()) {
873
+ actionstream << " Player: " << player->getName ()
874
+ << " tried to access item=" << item
875
+ << " out of hotbar_itemcount="
876
+ << player->getHotbarItemcount ()
877
+ << " ; ignoring." << std::endl;
878
+ return ;
879
+ }
880
+
872
881
playersao->getPlayer ()->setWieldIndex (item);
873
882
}
874
883
@@ -984,6 +993,16 @@ void Server::handleCommand_Interact(NetworkPacket *pkt)
984
993
v3f player_pos = playersao->getLastGoodPosition ();
985
994
986
995
// Update wielded item
996
+
997
+ if (item_i >= player->getHotbarItemcount ()) {
998
+ actionstream << " Player: " << player->getName ()
999
+ << " tried to access item=" << item_i
1000
+ << " out of hotbar_itemcount="
1001
+ << player->getHotbarItemcount ()
1002
+ << " ; ignoring." << std::endl;
1003
+ return ;
1004
+ }
1005
+
987
1006
playersao->getPlayer ()->setWieldIndex (item_i);
988
1007
989
1008
// Get pointed to object (NULL if not POINTEDTYPE_OBJECT)
0 commit comments