diff --git a/lua/zapret-lib.lua b/lua/zapret-lib.lua index de05616..edccb56 100644 --- a/lua/zapret-lib.lua +++ b/lua/zapret-lib.lua @@ -153,7 +153,7 @@ function apply_arg_prefix(desync) local c = string.sub(v,1,1) if c=='#' then local blb = blob(desync,string.sub(v,2)) - desync.arg[a] = (type(blb)=='string' or type(blb)=='table') and #blb or 0 + desync.arg[a] = tostring((type(blb)=='string' or type(blb)=='table') and #blb or 0) elseif c=='%' then desync.arg[a] = blob(desync,string.sub(v,2)) elseif c=='\\' then @@ -545,6 +545,7 @@ function blob(desync, name, def) error("blob '"..name.."' unavailable") end end + blob = tostring(blob) end return blob end diff --git a/nfq2/lua.c b/nfq2/lua.c index fcb5559..a783bce 100644 --- a/nfq2/lua.c +++ b/nfq2/lua.c @@ -1248,6 +1248,7 @@ void lua_push_blob(lua_State *L, int idx_desync, const char *blob) lua_pop(L,1); lua_getglobal(L, blob); } + lua_tostring(L,-1); } void lua_pushf_blob(lua_State *L, int idx_desync, const char *field, const char *blob) { @@ -1779,7 +1780,10 @@ void lua_pushf_args(lua_State *L, const struct str2_list_head *args, int idx_des lua_push_blob(L, idx_desync, val+1); lua_Integer len = lua_rawlen(L, -1); lua_pop(L,1); - lua_pushf_int(L, var, len); + lua_pushstring(L, var); + lua_pushinteger(L, len); + lua_tostring(L,-1); // force string type in arg + lua_rawset(L,-3); } else lua_pushf_str(L, var, val);