Skip to content

Commit

Permalink
Check filename argument in dofile/dofilex.
Browse files Browse the repository at this point in the history
  • Loading branch information
agraef committed Sep 4, 2024
1 parent 2095ab6 commit 4a7c4ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pdlua.c
Original file line number Diff line number Diff line change
Expand Up @@ -2260,6 +2260,7 @@ static int pdlua_dofilex(lua_State *L)
if (c)
{
filename = luaL_optstring(L, 2, NULL);
if (!filename) return 0;
fd = trytoopenone(c->c_externdir->s_name, filename, "",
buf, &ptr, MAXPDSTRING, 1);
if (fd >= 0)
Expand Down Expand Up @@ -2331,6 +2332,7 @@ static int pdlua_dofile(lua_State *L)
if (o)
{
filename = luaL_optstring(L, 2, NULL);
if (!filename) return 0;
fd = canvas_open(o->canvas, filename, "", buf, &ptr, MAXPDSTRING, 1);
if (fd >= 0)
{
Expand Down
2 changes: 1 addition & 1 deletion pdlua/tutorial/examples/pdx.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ end
-- present this only recognizes the "reload" message and checks the class
-- name, if given.
local function pdluax(self, sel, atoms)
if sel == "reload" then
if sel == "reload" and not string.match(self._scriptname, ".pd_luax$") then
-- reload message, check that any extra argument matches the class name
if atoms[1] == nil or atoms[1] == self._name then
-- invoke the prereload method if it exists
Expand Down

0 comments on commit 4a7c4ce

Please sign in to comment.