/apps/twnlua: catch self-include stack busting

This commit is contained in:
veclavtalica 2025-02-21 00:18:22 +03:00
parent 80a4ae3d0e
commit 70fab28158

View File

@ -25,6 +25,12 @@ void bindgen_upload_context(lua_State *L);
static int physfs_loader(lua_State *L) {
const char *name = luaL_checkstring(L, 1);
static const char *name_breaker = NULL;
if (name_breaker && SDL_strcmp(name, name_breaker) == 0) {
log_critical("Recursive load on itself from lua module (%s)", name_breaker);
return 0;
} name_breaker = name;
/* replace dots with path slashes */
char *path_copy = SDL_strdup(name);
char *ch = NULL;