From 80024fc1545dc1cb178d3f57627d12ae59231810 Mon Sep 17 00:00:00 2001 From: stujones11 Date: Sun, 12 Mar 2017 17:01:04 +0000 Subject: [PATCH] Fix security violation in player_textures mod support --- 3d_armor/armor.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/3d_armor/armor.lua b/3d_armor/armor.lua index 4324b3e..a4dbb72 100644 --- a/3d_armor/armor.lua +++ b/3d_armor/armor.lua @@ -146,6 +146,7 @@ elseif minetest.get_modpath("wardrobe") then skin_mod = "wardrobe" end + armor.def = { state = 0, count = 0, @@ -515,12 +516,14 @@ minetest.register_on_joinplayer(function(player) armor.textures[name].skin = skin end end - if minetest.get_modpath("player_textures") then - local filename = minetest.get_modpath("player_textures").."/textures/player_"..name - local f = io.open(filename..".png") - if f then - f:close() - armor.textures[name].skin = "player_"..name..".png" + local texture_path = minetest.get_modpath("player_textures") + if texture_path then + local dir_list = minetest.get_dir_list(texture_path.."/textures") + for _, fn in pairs(dir_list) do + if fn == "player_"..name..".png" then + armor.textures[name].skin = fn + break + end end end for i=1, ARMOR_INIT_TIMES do