From: Vsevolod Stakhov Date: Tue, 26 Nov 2013 23:09:04 +0000 (+0000) Subject: Avoid endless recursion while pushing ucl arrays to lua. X-Git-Tag: 0.6.0~5 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fb62c00c3201e96106d6531d8e60d8a96e109a41;p=rspamd.git Avoid endless recursion while pushing ucl arrays to lua. --- diff --git a/src/lua/lua_rcl.c b/src/lua/lua_rcl.c index cb5c46252..2768ac4a4 100644 --- a/src/lua/lua_rcl.c +++ b/src/lua/lua_rcl.c @@ -53,12 +53,12 @@ lua_rcl_obj_push_elt (lua_State *L, const char *key, ucl_object_t *obj) * @return */ static gint -lua_rcl_obj_push_obj (lua_State *L, ucl_object_t *obj) +lua_rcl_obj_push_obj (lua_State *L, ucl_object_t *obj, gboolean allow_array) { ucl_object_t *cur; ucl_object_iter_t it = NULL; - if (obj->next != NULL) { + if (allow_array && obj->next != NULL) { /* Actually we need to push this as an array */ return lua_rcl_obj_push_array (L, obj); } @@ -141,7 +141,7 @@ lua_rcl_obj_push (lua_State *L, ucl_object_t *obj, gboolean allow_array) { switch (obj->type) { case UCL_OBJECT: - return lua_rcl_obj_push_obj (L, obj); + return lua_rcl_obj_push_obj (L, obj, allow_array); case UCL_ARRAY: return lua_rcl_obj_push_array (L, obj->value.av); default: