Skip to content
Snippets Groups Projects
Commit 569f7d15 authored by wolfs's avatar wolfs
Browse files

Efficiency improvement in whitelist check

Thanks Inu!
parent a68e9269
No related branches found
No related tags found
No related merge requests found
...@@ -158,7 +158,7 @@ static int io_open (lua_State *L) { ...@@ -158,7 +158,7 @@ static int io_open (lua_State *L) {
const char *filename = luaL_checkstring(L, 1); const char *filename = luaL_checkstring(L, 1);
int pass = 0; int i; int pass = 0; int i;
int length = strlen(filename) - 1; int length = strlen(filename) - 1;
for (i = 0; i < 5; i++) // wolfs == noobcoder, so manually change this with any added file types for (i = 0; i < (sizeof (whitelist) / sizeof(const char *)); i++)
{ {
if (!stricmp(&filename[length - (strlen(whitelist[i]) - 1)], whitelist[i])) if (!stricmp(&filename[length - (strlen(whitelist[i]) - 1)], whitelist[i]))
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment