summaryrefslogtreecommitdiff
path: root/proxy_await.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2023-01-02 17:28:15 -0800
committerdormando <dormando@rydia.net>2023-01-02 17:28:15 -0800
commit3158e85e84909c81eeb60e719c3d582677ec32c8 (patch)
treee95038b8fecec862455595d1018b20abb74a4209 /proxy_await.c
parentd15bbb16d66263c571b3743084c8ea5249bf0718 (diff)
downloadmemcached-3158e85e84909c81eeb60e719c3d582677ec32c8.tar.gz
proxy: fix crash in await during SIGHUP reloads
- The await return process uses the "main" VM to move the response into the table we will eventually return to the user. - During the reload routine a nil can be left on the top of the main VM stack. - Safest to just use top-relative indexing for most cases where we use the main VM and aren't explicitly clearing the stack beforehand.
Diffstat (limited to 'proxy_await.c')
-rw-r--r--proxy_await.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/proxy_await.c b/proxy_await.c
index 5e379db..4a548a3 100644
--- a/proxy_await.c
+++ b/proxy_await.c
@@ -380,7 +380,7 @@ int mcplib_await_return(io_pending_proxy_t *p) {
// couldn't find a table.insert() equivalent; so this is
// inserting into the length + 1 position manually.
//dump_stack(L);
- lua_rawseti(L, 1, lua_rawlen(L, 1) + 1); // pops mcpres
+ lua_rawseti(L, -2, lua_rawlen(L, 1) + 1); // pops mcpres
lua_pop(L, 1); // pops restable
}