Fix security violation in player_textures mod support

This commit is contained in:
stujones11 2017-03-12 17:01:04 +00:00
parent d826b53877
commit 80024fc154

@ -146,6 +146,7 @@ elseif minetest.get_modpath("wardrobe") then
skin_mod = "wardrobe" skin_mod = "wardrobe"
end end
armor.def = { armor.def = {
state = 0, state = 0,
count = 0, count = 0,
@ -515,12 +516,14 @@ minetest.register_on_joinplayer(function(player)
armor.textures[name].skin = skin armor.textures[name].skin = skin
end end
end end
if minetest.get_modpath("player_textures") then local texture_path = minetest.get_modpath("player_textures")
local filename = minetest.get_modpath("player_textures").."/textures/player_"..name if texture_path then
local f = io.open(filename..".png") local dir_list = minetest.get_dir_list(texture_path.."/textures")
if f then for _, fn in pairs(dir_list) do
f:close() if fn == "player_"..name..".png" then
armor.textures[name].skin = "player_"..name..".png" armor.textures[name].skin = fn
break
end
end end
end end
for i=1, ARMOR_INIT_TIMES do for i=1, ARMOR_INIT_TIMES do