Fix detached inventory vulnerability (#23)

This commit is contained in:
Maksim 2020-11-03 22:22:14 +01:00 committed by GitHub
parent 7436fcdffe
commit 5958b312ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -193,6 +193,9 @@ local function init_player_armor(initplayer)
armor:set_player_armor(player) armor:set_player_armor(player)
end, end,
allow_put = function(inv, listname, index, put_stack, player) allow_put = function(inv, listname, index, put_stack, player)
if player:get_player_name() ~= name then
return 0
end
local element = armor:get_element(put_stack:get_name()) local element = armor:get_element(put_stack:get_name())
if not element then if not element then
return 0 return 0
@ -208,9 +211,15 @@ local function init_player_armor(initplayer)
return 1 return 1
end, end,
allow_take = function(inv, listname, index, stack, player) allow_take = function(inv, listname, index, stack, player)
if player:get_player_name() ~= name then
return 0
end
return stack:get_count() return stack:get_count()
end, end,
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if player:get_player_name() ~= name then
return 0
end
return count return count
end, end,
}, name) }, name)