]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Propagate key when import implicit array from Lua
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 24 Apr 2018 16:35:06 +0000 (17:35 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 24 Apr 2018 16:35:06 +0000 (17:35 +0100)
contrib/libucl/lua_ucl.c

index 15d41471e41976996e8957ba381e5e51c8dce19d..e1a784753a02ea37acde619bfb2796cacf9d7258 100644 (file)
@@ -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);
                }