From 0191a9c4c2749871887e3a2878a36afef90f832b Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 9 Aug 2017 04:07:23 +0200 Subject: Centralize Lua sandboxing --- libs/ardour/session.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libs/ardour/session.cc') diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 91f67cf3da..764e05c3e8 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -5500,6 +5500,7 @@ Session::setup_lua () lua.Print.connect (&_lua_print); #endif lua.tweak_rt_gc (); + lua.sandbox (true); lua.do_command ( "function ArdourSession ()" " local self = { scripts = {}, instances = {} }" @@ -5516,7 +5517,6 @@ Session::setup_lua () " assert(type(a) == 'table' or type(a) == 'nil', 'Given argument is invalid')" " assert(self.scripts[n] == nil, 'Callback \"'.. n ..'\" already exists.')" " self.scripts[n] = { ['f'] = f, ['a'] = a }" - " local env = _ENV; env.f = nil env.io = nil env.os = nil env.loadfile = nil env.require = nil env.dofile = nil env.package = nil env.debug = nil" " local env = { print = print, tostring = tostring, assert = assert, ipairs = ipairs, error = error, select = select, string = string, type = type, tonumber = tonumber, collectgarbage = collectgarbage, pairs = pairs, math = math, table = table, pcall = pcall, bit32=bit32, Session = Session, PBD = PBD, Timecode = Timecode, Evoral = Evoral, C = C, ARDOUR = ARDOUR }" " self.instances[n] = load (string.dump(f, true), nil, nil, env)(a)" " Session:scripts_changed()" // call back -- cgit v1.2.3