From 45b6947f49e47a5aff2e2a93a1cca2bc913d869c Mon Sep 17 00:00:00 2001 From: dacctal Date: Sat, 18 Jul 2026 08:40:27 +0000 Subject: fix segfault in get_pkgsrc() with invalid str_fmt args --- src/lua_globs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/lua_globs.c') diff --git a/src/lua_globs.c b/src/lua_globs.c index 00049b4..3f8ac2a 100644 --- a/src/lua_globs.c +++ b/src/lua_globs.c @@ -72,7 +72,6 @@ void init_lua_state(void) { config_loaded = true; } -// FIXME: ensure this is called ONCE for clarity void init_bldit_state(void) { if (B != NULL) return; @@ -85,7 +84,6 @@ void init_bldit_state(void) { } lua_pushfstring(B, "%s", inst_dirs.prefix.data); lua_setglobal(B, "prefix"); - lua_pop(B, 1); bldit_loaded = true; } @@ -126,11 +124,12 @@ void bldit_isnt_type(char *variable, char *type) { bool lua_try_function(lua_State *L, char *lua_file, char *fname) { lua_getfield(L, -1, fname); if (!lua_isfunction(L, -1)) { - if (strcmp(lua_file, "bldit.lua")) + if (!strcmp(lua_file, "bldit.lua")) bldit_isnt_type(fname, "function"); else lua_isnt_type(fname, "function"); lua_pop(L, 1); + return false; } else if (lua_pcall(L, 0, 1, 0) != LUA_OK) { if (flags.verbose) log_warn("%s: '%s' function borked: %s", lua_file, fname, -- cgit v1.2.3