mirror of https://github.com/minetest/minetest.git
Inventory: Fix rare out-of-bounds access
Co-authored-by: Thomas--S <info@thomas-stangl.de>
This commit is contained in:
parent
dad87a360b
commit
eea488ed75
|
@ -322,12 +322,20 @@ void IMoveAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGame
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((u16)to_i > list_to->getSize()) {
|
if (from_i < 0 || list_from->getSize() <= (u32) from_i) {
|
||||||
infostream << "IMoveAction::apply(): FAIL: destination index out of bounds: "
|
infostream << "IMoveAction::apply(): FAIL: source index out of bounds: "
|
||||||
<< "to_i=" << to_i
|
<< "size of from_list=\"" << list_from->getSize() << "\""
|
||||||
<< ", size=" << list_to->getSize() << std::endl;
|
<< ", from_index=\"" << from_i << "\"" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (to_i < 0 || list_to->getSize() <= (u32) to_i) {
|
||||||
|
infostream << "IMoveAction::apply(): FAIL: destination index out of bounds: "
|
||||||
|
<< "size of to_list=\"" << list_to->getSize() << "\""
|
||||||
|
<< ", to_index=\"" << to_i << "\"" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Do not handle rollback if both inventories are that of the same player
|
Do not handle rollback if both inventories are that of the same player
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue