From 5ea12787f87f3ea60935b7a1f5b24be80cb2dec6 Mon Sep 17 00:00:00 2001 From: ame Date: Mon, 1 Dec 2025 21:12:42 -0600 Subject: minor net changes, prevent buffer indexing evil metatables --- src/net.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/net.c') 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); -- cgit v1.2.3