diff options
author | dormando <dormando@rydia.net> | 2023-05-07 23:26:12 -0700 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2023-05-07 23:30:48 -0700 |
commit | 894f381033c6ed0b6fa285603571d6f791754bad (patch) | |
tree | dc95126b3952546bae424b05d0a062da7e58fd72 /proxy_config.c | |
parent | 7efa06de573cd542431ab306a7048e436e8f4d5b (diff) | |
download | memcached-894f381033c6ed0b6fa285603571d6f791754bad.tar.gz |
proxy: fix config_routes numeric table copy
If the table returned from config_pools had numeric keys it would fail
to copy them into config_routes properly.
Without patch:
Failed to execute mcp_config_routes: t/config.lua:9:
attempt to concatenate a nil value (field 'integer index')
function mcp_config_routes()
return { [1] = "val" }
end
Diffstat (limited to 'proxy_config.c')
-rw-r--r-- | proxy_config.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/proxy_config.c b/proxy_config.c index 98af5c2..b3ec6c1 100644 --- a/proxy_config.c +++ b/proxy_config.c @@ -347,10 +347,10 @@ static void _copy_config_table(lua_State *from, lua_State *to, LIBEVENT_THREAD * lua_pushlstring(to, lua_tostring(from, -2), lua_rawlen(from, -2)); break; case LUA_TNUMBER: - if (lua_isinteger(from, -1)) { - lua_pushinteger(to, lua_tointeger(from, -1)); + if (lua_isinteger(from, -2)) { + lua_pushinteger(to, lua_tointeger(from, -2)); } else { - lua_pushnumber(to, lua_tonumber(from, -1)); + lua_pushnumber(to, lua_tonumber(from, -2)); } break; default: |