aboutsummaryrefslogtreecommitdiff
path: root/src/net.c
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.c
parenta7caf5e9f4ca1cfddafaf5880d7ee2020e3c1578 (diff)
minor net changes, prevent buffer indexing evil metatables
Diffstat (limited to 'src/net.c')
-rw-r--r--src/net.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/net.c b/src/net.c
index abab731..c9fdc08 100644
--- a/src/net.c
+++ b/src/net.c
@@ -843,6 +843,8 @@ void* handle_client(void *_arg){
luaI_tsetv(L, res_idx, "header", header_idx);
+ lua_pushcfunction(L, luaI_errtraceback);
+ int errtraceback_idx = lua_gettop(L);
//get all function that kinda match
parray_t* owo = (parray_t*)v;
for(int i = 0; i != owo->len; i++){
@@ -877,7 +879,7 @@ void* handle_client(void *_arg){
lua_pushvalue(L, req_idx); //push info about the request
//call the function
- if(lua_pcall(L, 2, 0, 0) != 0){
+ if(lua_pcall(L, 2, 0, errtraceback_idx) != 0){
fprintf(stderr, "(net thread) %s\n", lua_tostring(L, -1));
//send an error message if send has not been called
if(client_fd >= 0) net_error(client_fd, 500);