aboutsummaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorame <[email protected]>2025-12-01 21:12:42 -0600
committerame <[email protected]>2025-12-01 21:12:42 -0600
commit5ea12787f87f3ea60935b7a1f5b24be80cb2dec6 (patch)
treeb3083c5b7cad5fa58288c0dfd6b77d6b5677eacd /src/net
parenta7caf5e9f4ca1cfddafaf5880d7ee2020e3c1578 (diff)
minor net changes, prevent buffer indexing evil metatables
Diffstat (limited to 'src/net')
-rw-r--r--src/net/lua.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/net/lua.c b/src/net/lua.c
index 829c2f7..f005185 100644
--- a/src/net/lua.c
+++ b/src/net/lua.c
@@ -210,6 +210,9 @@ int l_sendfile(lua_State* L){
if(!lua_isnil(L, -1)) filename = (char*)lua_tostring(L, -1);
}
+ luaI_assert(L, !access(path, F_OK) /*file not found*/);
+ luaI_assert(L, !access(path, R_OK) /*missing permissions*/);
+
lua_pushvalue(L, res_idx);
lua_pushstring(L, "client_fd");
lua_gettable(L, res_idx);
@@ -221,9 +224,6 @@ int l_sendfile(lua_State* L){
lua_gettable(L, -2);
int header = lua_gettop(L);
- luaI_assert(L, !access(path, F_OK) /*file not found*/);
- luaI_assert(L, !access(path, R_OK) /*missing permissions*/);
-
lua_pushstring(L, "Content-Type");
lua_gettable(L, header);