Fix potential security vulnability in diplomacy form

master
rubenwardy 2016-03-31 16:45:50 +01:00
parent 904015f72c
commit fc1edfa22c
1 changed files with 10 additions and 10 deletions

View File

@ -286,18 +286,18 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
local tname = tplayer.team
local team = ctf.team(tname)
if not team then
if not team or formname ~= "ctf:diplo" then
return false
end
if formname == "ctf:diplo" then
for key, field in pairs(fields) do
local tname2 = string.match(key, "team_(.+)")
if tname2 and ctf.team(tname2) then
ctf.gui.show(name, "diplo", tname2)
return true
end
for key, field in pairs(fields) do
local tname2 = string.match(key, "team_(.+)")
if tname2 and ctf.team(tname2) then
ctf.gui.show(name, "diplo", tname2)
return true
end
if ctf.can_mod(name, tname) then
tname2 = string.match(key, "peace_(.+)")
if tname2 then
if ctf.diplo.get(tname, tname2) == "war" then
@ -348,6 +348,6 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
ctf.gui.show(name, "diplo")
return true
end
end
end
end -- end if can mod
end -- end for each field
end)