Skip to content

Commit

Permalink
Merge pull request #24 from mattaezell/fix_logging
Browse files Browse the repository at this point in the history
Ensure loadstr_table is null-terminated
  • Loading branch information
kcgthb authored Oct 13, 2022
2 parents 064b824 + c04c04f commit 3144895
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -1001,9 +1001,9 @@ static int SPANK_table_create (lua_State *L)
for (i = 0; i < sizeof(log_levels) / sizeof(log_levels[0]); i++) {
char loadstr[64];
#if LUA_VERSION_NUM >= 502
char loadstr_table[6] = "table.";
char loadstr_table[7] = "table.";
#else
char loadstr_table[6] = "";
char loadstr_table[7] = "";
#endif
snprintf(loadstr, 64, "SPANK._log_msg (%d, string.format(%sunpack({...})))", i-1, loadstr_table);
luaL_loadstring (L, loadstr);
Expand Down

0 comments on commit 3144895

Please sign in to comment.