From: Nathan Neulinger Date: Wed, 4 Mar 2020 02:32:47 +0000 (-0600) Subject: BUG/MINOR: lua: Add missing string length for lua sticktable lookup X-Git-Tag: v2.2-dev9~177 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=31a841c323b0e9692695a57d4747f71a32b9fb68;p=thirdparty%2Fhaproxy.git BUG/MINOR: lua: Add missing string length for lua sticktable lookup In hlua_stktable_lookup(), the key length is never set so all stktable:lookup("key") calls return nil from lua. This patch must be backported as far as 1.9. [Cf: I slightly updated the patch to use lua_tolstring() instead of luaL_checkstring() + strlen()] --- diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c index faf9d7de04..a914066031 100644 --- a/src/hlua_fcn.c +++ b/src/hlua_fcn.c @@ -617,7 +617,7 @@ int hlua_stktable_lookup(lua_State *L) t = hlua_check_stktable(L, 1); smp.data.type = SMP_T_STR; smp.flags = SMP_F_CONST; - smp.data.u.str.area = (char *)luaL_checkstring(L, 2); + smp.data.u.str.area = (char *)lua_tolstring(L, 2, &smp.data.u.str.data); skey = smp_to_stkey(&smp, t); if (!skey) {