]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/engine: fixed json pack for str-encoded int
authorMarek Vavrusa <marek@vavrusa.com>
Mon, 13 Jun 2016 16:53:11 +0000 (09:53 -0700)
committerMarek Vavrusa <marek@vavrusa.com>
Wed, 6 Jul 2016 06:33:38 +0000 (23:33 -0700)
string encoded integers are treated as possible
numbers, so a more strict typecheck is needed

daemon/engine.c

index 3a6251cd07a0d91f8f16b9348a982923f52f17cf..3ab9bbaa59fe2841755f3a093f5c9d25290cf5ed 100644 (file)
@@ -291,7 +291,7 @@ static JsonNode *l_pack_elem(lua_State *L, int top)
        while(lua_next(L, top) != 0) {
                bool is_array = false;
                if (!node) {
-                       is_array = lua_isnumber(L, top + 1);
+                       is_array = (lua_type(L, top + 1) == LUA_TNUMBER);
                        node = is_array ? json_mkarray() : json_mkobject();
                        if (!node) {
                                return NULL;