Software /
code /
clix
Changeset
167:57bb6e03d239
clix.raw: Update sandboxing to use util.envload and work with Lua 5.2+
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 02 Mar 2023 18:01:05 +0100 |
parents | 166:b0c586241224 |
children | 168:75e8ca131178 |
files | clix/raw.lua |
diffstat | 1 files changed, 2 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/clix/raw.lua Wed Aug 03 03:02:12 2022 +0200 +++ b/clix/raw.lua Thu Mar 02 18:01:05 2023 +0100 @@ -1,4 +1,5 @@ local verse = require "verse"; +local envload = require "util.envload".envload; local xml = require "util.xml"; short_opts.i = "interactive"; short_opts.e = "echo"; @@ -96,15 +97,12 @@ else data = "return "..data; end - local chunk, err = loadstring(data, "@stdin"); + local chunk, err = envload(data, "@stdin", sandboxed and env or _G); if not chunk then conn:error(err); return; end data = ""; - if sandboxed then - setfenv(chunk, env); - end local ok, ret = pcall(chunk); if ok then data = ret