From 0aa83e49322e7df2ccfb6e4b8490bc10163d593a Mon Sep 17 00:00:00 2001
From: orwell96 <orwell@bleipb.de>
Date: Fri, 4 Sep 2020 16:15:27 +0200
Subject: Escape fields in wagon properties (H#158)

---
 advtrains/wagons.lua | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'advtrains')

diff --git a/advtrains/wagons.lua b/advtrains/wagons.lua
index f2ff897..d10dce0 100644
--- a/advtrains/wagons.lua
+++ b/advtrains/wagons.lua
@@ -810,8 +810,8 @@ function wagon:show_wagon_properties(pname)
 	]]
 	local data = advtrains.wagons[self.id]
 	local form="size[5,5]"
-	form = form .. "field[0.5,1;4.5,1;whitelist;Allow these players to access your wagon:;"..(data.whitelist or "").."]"
-	form = form .. "field[0.5,2;4.5,1;roadnumber;Wagon road number:;"..(data.roadnumber or "").."]"
+	form = form .. "field[0.5,1;4.5,1;whitelist;Allow these players to access your wagon:;"..minetest.formspec_escape(data.whitelist or "").."]"
+	form = form .. "field[0.5,2;4.5,1;roadnumber;Wagon road number:;"..minetest.formspec_escape(data.roadnumber or "").."]"
 	local fc = ""
 	if data.fc then
 		fc = table.concat(data.fc, "!")
@@ -825,7 +825,7 @@ function wagon:show_wagon_properties(pname)
 		form=form.."label[1.5,3.5;Current FC:]"
 
 		local cur = data.fc[data.fcind] or ""
-		form=form.."label[1.5,3.75;"..cur.."]"
+		form=form.."label[1.5,3.75;"..minetest.formspec_escape(cur).."]"
 		form=form.."button[3.5,3.5;1,1;fcn;next FC]"
 	end
 	form=form.."button_exit[0.5,4.5;4,1;save;"..attrans("Save wagon properties").."]"
-- 
cgit v1.2.3