From: Vsevolod Stakhov Date: Tue, 24 Apr 2018 16:35:06 +0000 (+0100) Subject: [Fix] Propagate key when import implicit array from Lua X-Git-Tag: 1.7.4~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3efef0fad233598784af91407f7acda08026265b;p=thirdparty%2Frspamd.git [Fix] Propagate key when import implicit array from Lua --- diff --git a/contrib/libucl/lua_ucl.c b/contrib/libucl/lua_ucl.c index 15d41471e4..e1a784753a 100644 --- a/contrib/libucl/lua_ucl.c +++ b/contrib/libucl/lua_ucl.c @@ -297,7 +297,7 @@ ucl_object_push_lua (lua_State *L, const ucl_object_t *obj, bool allow_array) static ucl_object_t * ucl_object_lua_fromtable (lua_State *L, int idx, ucl_string_flags_t flags) { - ucl_object_t *obj, *top = NULL; + ucl_object_t *obj, *top = NULL, *cur; size_t keylen; const char *k; bool is_array = true, is_implicit = false, found_mt = false; @@ -407,6 +407,13 @@ ucl_object_lua_fromtable (lua_State *L, int idx, ucl_string_flags_t flags) if (obj != NULL) { ucl_object_insert_key (top, obj, k, keylen, true); + + DL_FOREACH (obj, cur) { + if (cur->keylen == 0) { + cur->keylen = keylen; + cur->key = k; + } + } } lua_pop (L, 2); }